kaddressbook Library API Documentation

kaddressbookmain.cpp

00001 /*
00002     This file is part of KAddressbook.
00003     Copyright (c) 1999 Don Sanders <dsanders@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #include <kedittoolbar.h>
00025 #include <kkeydialog.h>
00026 #include <klocale.h>
00027 #include <kmessagebox.h>
00028 #include <kstatusbar.h>
00029 
00030 #include "kabcore.h"
00031 
00032 #include "kaddressbookmain.h"
00033 
00034 KAddressBookMain::KAddressBookMain()
00035   : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 )
00036 {
00037   setCaption( i18n( "Address Book Browser" ) );
00038 
00039   mCore = new KABCore( this, true, this );
00040   mCore->restoreSettings();
00041 
00042   initActions();
00043 
00044   setCentralWidget( mCore->widget() );
00045 
00046   statusBar()->show();
00047   mCore->setStatusBar( statusBar() );
00048 
00049   setStandardToolBarMenuEnabled( true );
00050 
00051   createGUI( "kaddressbookui.rc", false );
00052 
00053   resize( 400, 300 ); // initial size
00054   setAutoSaveSettings();
00055 }
00056 
00057 KAddressBookMain::~KAddressBookMain()
00058 {
00059   mCore->saveSettings();
00060 }
00061 
00062 void KAddressBookMain::addEmail( QString addr )
00063 {
00064   mCore->addEmail( addr );
00065 }
00066 
00067 void KAddressBookMain::importVCard( const QString& file )
00068 {
00069   mCore->importVCard( KURL( file ) );
00070 }
00071 
00072 ASYNC KAddressBookMain::showContactEditor( QString uid )
00073 {
00074   mCore->editContact( uid );
00075 }
00076 
00077 void KAddressBookMain::newContact()
00078 {
00079   mCore->newContact();
00080 }
00081 
00082 QString KAddressBookMain::getNameByPhone( QString phone )
00083 {
00084   return mCore->getNameByPhone( phone );
00085 }
00086 
00087 void KAddressBookMain::save()
00088 {
00089   mCore->save();
00090 }
00091 
00092 void KAddressBookMain::exit()
00093 {
00094   close();
00095 }
00096 
00097 bool KAddressBookMain::handleCommandLine()
00098 {
00099   return mCore->handleCommandLine( this );
00100 }
00101 
00102 void KAddressBookMain::saveProperties( KConfig* )
00103 {
00104 }
00105 
00106 void KAddressBookMain::readProperties( KConfig* )
00107 {
00108 }
00109 
00110 void KAddressBookMain::initActions()
00111 {
00112   KStdAction::quit( this, SLOT( close() ), actionCollection() );
00113 
00114   KAction *action;
00115   action = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
00116   action->setWhatsThis( i18n( "You will be presented with a dialog, where you can configure the application wide shortcuts." ) );
00117 
00118   KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
00119 }
00120 
00121 void KAddressBookMain::configureKeyBindings()
00122 {
00123   KKeyDialog::configure( actionCollection(), this );
00124 }
00125 
00126 void KAddressBookMain::configureToolbars()
00127 {
00128   saveMainWindowSettings( KGlobal::config(), "MainWindow" );
00129 
00130   KEditToolbar edit( factory() );
00131   connect( &edit, SIGNAL( newToolbarConfig() ),
00132            this, SLOT( slotNewToolbarConfig() ) );
00133 
00134   edit.exec();
00135 }
00136 
00137 void KAddressBookMain::newToolbarConfig()
00138 {
00139   createGUI();
00140   applyMainWindowSettings( KGlobal::config(), "MainWindow" );
00141 }
00142 
00143 #include "kaddressbookmain.moc"
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:52 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003