add more spacing
[personal-kdebase.git] / runtime / kurifilter-plugins / ikws / kurisearchfilter.cpp
blob2a757f432fc4690a0795d70d4ed4716cbef05b6e
1 /* This file is part of the KDE project
2 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
3 Copyright (C) 2000 Yves Arrouye <yves@realnames.com>
4 Copyright (C) 2002, 2003 Dawit Alemayehu <adawit@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "kurisearchfilter.h"
24 #include <QtDBus/QtDBus>
26 #include "kuriikwsfiltereng.h"
27 #include "ikwsopts.h"
29 /**
30 * IMPORTANT: If you change anything here, please run the regression test
31 * ../tests/kurifiltertest
34 K_PLUGIN_FACTORY(KUriSearchFilterFactory, registerPlugin<KUriSearchFilter>();)
35 K_EXPORT_PLUGIN(KUriSearchFilterFactory("kcmkurifilt"))
37 KUriSearchFilter::KUriSearchFilter(QObject *parent,
38 const QVariantList &)
39 :KUriFilterPlugin( "kurisearchfilter", parent )
41 KGlobal::locale()->insertCatalog("kurifilter");
42 QDBusConnection::sessionBus().connect(QString(), QString(), "org.kde.KUriFilterPlugin",
43 "configure", this, SLOT(configure()));
46 KUriSearchFilter::~KUriSearchFilter()
50 void KUriSearchFilter::configure()
52 if ( KURISearchFilterEngine::self()->verbose() )
53 kDebug() << "KUriSearchFilter::configure: Config reload request...";
55 KURISearchFilterEngine::self()->loadConfig();
58 bool KUriSearchFilter::filterUri( KUriFilterData &data ) const
60 if ( KURISearchFilterEngine::self()->verbose() )
61 kDebug() << "KUriSearchFilter::filterUri: '" << data.typedString() << "'";
63 QString result = KURISearchFilterEngine::self()->webShortcutQuery( data.typedString() );
65 if ( !result.isEmpty() )
67 if ( KURISearchFilterEngine::self()->verbose() )
68 kDebug() << "Filtered URL: " << result;
70 setFilteredUri( data, KUrl( result ) );
71 setUriType( data, KUriFilterData::NetProtocol );
72 return true;
75 return false;
78 KCModule *KUriSearchFilter::configModule(QWidget *parent, const char *) const
80 return new FilterOptions( KUriSearchFilterFactory::componentData(), parent);
83 QString KUriSearchFilter::configName() const
85 return i18n("Search F&ilters");
88 #include "kurisearchfilter.moc"