summaryrefslogtreecommitdiffstats
path: root/kaddressbook/kaddressbookmain.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kaddressbook/kaddressbookmain.cpp
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaddressbook/kaddressbookmain.cpp')
-rw-r--r--kaddressbook/kaddressbookmain.cpp186
1 files changed, 186 insertions, 0 deletions
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
new file mode 100644
index 000000000..a3a145b3c
--- /dev/null
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -0,0 +1,186 @@
+/*
+ This file is part of KAddressbook.
+ Copyright (c) 1999 Don Sanders <dsanders@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; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include <kedittoolbar.h>
+#include <kkeydialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kstatusbar.h>
+
+#include <libkdepim/statusbarprogresswidget.h>
+#include <libkdepim/progressdialog.h>
+
+#include "kabcore.h"
+
+#include "kaddressbookmain.h"
+
+KAddressBookMain::KAddressBookMain( const QString &file )
+ : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 )
+{
+ // Set this to be the group leader for all subdialogs - this means
+ // modal subdialogs will only affect this dialog, not the other windows
+ setWFlags( getWFlags() | WGroupLeader );
+
+ setCaption( i18n( "Address Book Browser" ) );
+
+ mCore = new KABCore( this, true, this, file );
+ mCore->restoreSettings();
+
+ initActions();
+
+ setCentralWidget( mCore->widget() );
+
+ statusBar()->show();
+ statusBar()->insertItem( "", 1 );
+
+ KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(),
+ this );
+ progressDialog->hide();
+
+ KPIM::StatusbarProgressWidget *progressWidget;
+ progressWidget = new KPIM::StatusbarProgressWidget( progressDialog,
+ statusBar() );
+ progressWidget->show();
+
+ statusBar()->addWidget( progressWidget, 0, true );
+
+ mCore->setStatusBar( statusBar() );
+
+ setStandardToolBarMenuEnabled( true );
+
+ createGUI( "kaddressbookui.rc", false );
+
+ resize( 400, 300 ); // initial size
+ setAutoSaveSettings();
+}
+
+KAddressBookMain::~KAddressBookMain()
+{
+ mCore->saveSettings();
+}
+
+void KAddressBookMain::addEmail( QString addr )
+{
+ mCore->addEmail( addr );
+}
+
+void KAddressBookMain::importVCard( const KURL& url )
+{
+ mCore->importVCard( url );
+}
+
+void KAddressBookMain::importVCardFromData( const QString& vCard )
+{
+ mCore->importVCardFromData( vCard );
+}
+
+ASYNC KAddressBookMain::showContactEditor( QString uid )
+{
+ mCore->editContact( uid );
+}
+
+void KAddressBookMain::newDistributionList()
+{
+ mCore->newDistributionList();
+}
+
+void KAddressBookMain::newContact()
+{
+ mCore->newContact();
+}
+
+QString KAddressBookMain::getNameByPhone( QString phone )
+{
+ return mCore->getNameByPhone( phone );
+}
+
+void KAddressBookMain::save()
+{
+ mCore->save();
+}
+
+void KAddressBookMain::exit()
+{
+ close();
+}
+
+bool KAddressBookMain::handleCommandLine()
+{
+ return mCore->handleCommandLine( this );
+}
+
+void KAddressBookMain::saveProperties( KConfig* )
+{
+}
+
+void KAddressBookMain::readProperties( KConfig* )
+{
+}
+
+bool KAddressBookMain::queryClose()
+{
+ return mCore->queryClose();
+}
+
+void KAddressBookMain::initActions()
+{
+ KStdAction::quit( this, SLOT( close() ), actionCollection() );
+
+ KAction *action;
+ action = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
+ action->setWhatsThis( i18n( "You will be presented with a dialog, where you can configure the application wide shortcuts." ) );
+
+ KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
+}
+
+void KAddressBookMain::configureKeyBindings()
+{
+ KKeyDialog::configure( actionCollection(), this );
+}
+
+void KAddressBookMain::loadProfile( const QString& )
+{
+}
+
+void KAddressBookMain::saveToProfile( const QString& ) const
+{
+}
+
+void KAddressBookMain::configureToolbars()
+{
+ saveMainWindowSettings( KGlobal::config(), "MainWindow" );
+
+ KEditToolbar edit( factory() );
+ connect( &edit, SIGNAL( newToolbarConfig() ),
+ this, SLOT( newToolbarConfig() ) );
+
+ edit.exec();
+}
+
+void KAddressBookMain::newToolbarConfig()
+{
+ createGUI( "kaddressbookui.rc", false );
+ applyMainWindowSettings( KGlobal::config(), "MainWindow" );
+}
+
+#include "kaddressbookmain.moc"