summaryrefslogtreecommitdiffstats
path: root/kcontrol/konq/browser.cpp
blob: a17631927e560f16aa37622481daf44203fcbcf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* This file is part of the KDE project
   Copyright (C) 2002 Waldo Bastian <[email protected]>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#include <tqlayout.h>
#include <tqtabwidget.h>
#include <tqfile.h>

#include <klocale.h>
#include <kdialog.h>
#include <fixx11h.h>
#include <kcmoduleloader.h>

#include "behaviour.h"
#include "fontopts.h"
#include "previews.h"
#include "browser.h"

KBrowserOptions::KBrowserOptions(KConfig *config, TQString group, TQWidget *parent, const char *name)
    : KCModule( parent, "kcmkonq" ) 
{
  TQVBoxLayout *tqlayout = new TQVBoxLayout(this);
  TQTabWidget *tab = new TQTabWidget(this);
  tqlayout->addWidget(tab);

  appearance = new KonqFontOptions(config, group, false, tab, name);
  appearance->tqlayout()->setMargin( KDialog::marginHint() );

  behavior = new KBehaviourOptions(config, group, tab, name);
  behavior->tqlayout()->setMargin( KDialog::marginHint() );

  previews = new KPreviewOptions(tab, name);
  previews->tqlayout()->setMargin( KDialog::marginHint() );

  kuick = KCModuleLoader::loadModule("kcmkuick", tab);

  tab->addTab(appearance, i18n("&Appearance"));
  tab->addTab(behavior, i18n("&Behavior"));
  tab->addTab(previews, i18n("&Previews && Meta-Data"));
  if (kuick)
  {
    kuick->tqlayout()->setMargin( KDialog::marginHint() );
    tab->addTab(kuick, i18n("&Quick Copy && Move"));
  }

  connect(appearance, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
  connect(behavior, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
  connect(previews, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
  if (kuick)
     connect(kuick, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));

  connect(tab, TQT_SIGNAL(currentChanged(TQWidget *)), 
          this, TQT_SIGNAL(quickHelpChanged()));
  m_tab = tab;
}

void KBrowserOptions::load()
{
  appearance->load();
  behavior->load();
  previews->load();
  if (kuick)
     kuick->load();
}

void KBrowserOptions::defaults()
{
  appearance->defaults();
  behavior->defaults();
  previews->defaults();
  if (kuick)
     kuick->defaults();
}

void KBrowserOptions::save()
{
  appearance->save();
  behavior->save();
  previews->save();
  if (kuick)
     kuick->save();
}

TQString KBrowserOptions::quickHelp() const
{
  TQWidget *w = m_tab->currentPage();
  if (w->inherits("KCModule"))
  {
     KCModule *m = static_cast<KCModule *>(w);
     return m->quickHelp();
  }
  return TQString::null;
}

#include "browser.moc"