summaryrefslogtreecommitdiffstats
path: root/kcontrol/ebrowsing/main.cpp
blob: f6e5efc49d470446f815207d2d0794ebc89d3b16 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * main.cpp
 *
 * Copyright (c) 2000 Yves Arrouye <yves@realnames.com>
 *
 * Requires the Qt widget libraries, available at no cost at
 * http://www.troll.no/
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <unistd.h>

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

#include <dcopclient.h>
#include <kdialog.h>
#include <kurifilter.h>
#include <kgenericfactory.h>

#include "filteropts.h"
#include "main.h"

typedef KGenericFactory<KURIFilterModule, TQWidget> KURIFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kurifilt, KURIFactory("kcmkurifilt") )

class FilterOptions;

KURIFilterModule::KURIFilterModule(TQWidget *parent, const char *name, const TQStringList &)
                 :KCModule(KURIFactory::instance(), parent, name)
{

    filter = KURIFilter::self();

    setQuickHelp( i18n("<h1>Enhanced Browsing</h1> In this module you can configure some enhanced browsing"
      " features of KDE. <h2>Internet Keywords</h2>Internet Keywords let you"
      " type in the name of a brand, a project, a celebrity, etc... and go to the"
      " relevant location. For example you can just type"
      " \"KDE\" or \"K Desktop Environment\" in Konqueror to go to KDE's homepage."
      "<h2>Web Shortcuts</h2>Web Shortcuts are a quick way of using Web search engines. For example, type \"altavista:frobozz\""
      " or \"av:frobozz\" and Konqueror will do a search on AltaVista for \"frobozz\"."
      " Even easier: just press Alt+F2 (if you have not"
      " changed this shortcut) and enter the shortcut in the KDE Run Command dialog."));

    TQVBoxLayout *tqlayout = new TQVBoxLayout(this);

#if 0
    opts = new FilterOptions(this);
    tab->addTab(opts, i18n("&Filters"));
    connect(opts, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
#endif

    modules.setAutoDelete(true);

    TQMap<TQString,KCModule*> helper;
    TQPtrListIterator<KURIFilterPlugin> it = filter->pluginsIterator();
    for (; it.current(); ++it)
    {
        KCModule *module = it.current()->configModule(this, 0);
        if (module)
        {
            modules.append(module);
            helper.insert(it.current()->configName(), module);
            connect(module, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
        }
    }

    if (modules.count() > 1)
    {
        TQTabWidget *tab = new TQTabWidget(this);

        TQMapIterator<TQString,KCModule*> it2;
        for (it2 = helper.begin(); it2 != helper.end(); ++it2)
        {
            tab->addTab(it2.data(), it2.key());
        }

        tab->showPage(modules.first());
        widget = tab;
    }
    else if (modules.count() == 1)
    {
        widget = modules.first();
        tqlayout->setMargin(-KDialog::marginHint());
    }

    tqlayout->addWidget(widget);
}

void KURIFilterModule::load()
{
    TQPtrListIterator<KCModule> it(modules);
    for (; it.current(); ++it)
    {
	  it.current()->load();
    }
}

void KURIFilterModule::save()
{
    TQPtrListIterator<KCModule> it(modules);
    for (; it.current(); ++it)
    {
	  it.current()->save();
    }
}

void KURIFilterModule::defaults()
{
    TQPtrListIterator<KCModule> it(modules);
    for (; it.current(); ++it)
    {
	  it.current()->defaults();
    }
}

#include "main.moc"