You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kerry/kerry/src/kcm/kerry.cpp

114 lines
3.3 KiB

/*****************************************************************
Copyright (c) 2006 Stephan Binner <binner@kde.org>
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; see the file COPYING. 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 <dcopclient.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klocale.h>
#include <kprocess.h>
#include "kerry.h"
#include "search.h"
#include "indexing.h"
#include "backends.h"
#include "status.h"
KCMKerry::KCMKerry(TQWidget *parent, const char *name)
: KCModule( parent, "kcmkerry" )
{
setButtons(Default+Apply);
TQVBoxLayout *layout = new TQVBoxLayout(this);
m_tab = new TQTabWidget(this);
layout->addWidget(m_tab);
m_search = new KCMKerrySearch( m_tab, name );
m_search->layout()->setMargin( KDialog::marginHint() );
m_indexing = new KCMBeagleIndexing( m_tab, name );
m_indexing->layout()->setMargin( KDialog::marginHint() );
m_backends = new KCMBeagleBackends( m_tab, name );
m_backends->layout()->setMargin( KDialog::marginHint() );
m_status = new KCMBeagleStatus( m_tab, name );
m_status->layout()->setMargin( KDialog::marginHint() );
m_tab->addTab(m_search, i18n("&Search"));
m_tab->addTab(m_indexing, i18n("&Indexing"));
m_tab->addTab(m_backends, i18n("&Backends"));
m_tab->addTab(m_status, i18n("&Daemon Status"));
connect(m_search, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
connect(m_indexing, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
connect(m_backends, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
connect(m_status, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
connect(m_tab, TQT_SIGNAL(currentChanged(TQWidget *)), TQT_SIGNAL(quickHelpChanged()));
}
void KCMKerry::load()
{
m_search->load();
m_indexing->load();
m_backends->load();
m_status->load();
}
void KCMKerry::defaults()
{
m_search->defaults();
m_indexing->defaults();
m_backends->defaults();
m_status->defaults();
}
void KCMKerry::save()
{
m_search->save();
m_indexing->save();
m_backends->save();
m_status->save();
DCOPClient *client = kapp->dcopClient();
client->send("kerry", "default", "configChanged()", TQString(""));
TDEProcess *proc = new TDEProcess;
*proc << "beagle-config";
*proc << "--beagled-reload-config";
if (!proc->start())
kdError("Could not make Beagle reload its config.");
}
TQString KCMKerry::quickHelp() const
{
TQWidget *w = m_tab->currentPage();
if (w->inherits("KCModule"))
{
KCModule *m = static_cast<KCModule *>(w);
return m->quickHelp();
}
return TQString();
}
#include "kerry.moc"