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( const QString &file ) 00035 : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) 00036 { 00037 setCaption( i18n( "Address Book Browser" ) ); 00038 00039 mCore = new KABCore( this, true, this, file ); 00040 mCore->restoreSettings(); 00041 00042 initActions(); 00043 00044 setCentralWidget( mCore->widget() ); 00045 00046 statusBar()->show(); 00047 statusBar()->insertItem( "", 1 ); 00048 mCore->setStatusBar( statusBar() ); 00049 00050 setStandardToolBarMenuEnabled( true ); 00051 00052 createGUI( "kaddressbookui.rc", false ); 00053 00054 resize( 400, 300 ); // initial size 00055 setAutoSaveSettings(); 00056 } 00057 00058 KAddressBookMain::~KAddressBookMain() 00059 { 00060 mCore->saveSettings(); 00061 } 00062 00063 void KAddressBookMain::addEmail( QString addr ) 00064 { 00065 mCore->addEmail( addr ); 00066 } 00067 00068 void KAddressBookMain::importVCard( const QString& file ) 00069 { 00070 mCore->importVCard( KURL( file ) ); 00071 } 00072 00073 ASYNC KAddressBookMain::showContactEditor( QString uid ) 00074 { 00075 mCore->editContact( uid ); 00076 } 00077 00078 void KAddressBookMain::newContact() 00079 { 00080 mCore->newContact(); 00081 } 00082 00083 QString KAddressBookMain::getNameByPhone( QString phone ) 00084 { 00085 return mCore->getNameByPhone( phone ); 00086 } 00087 00088 void KAddressBookMain::save() 00089 { 00090 mCore->save(); 00091 } 00092 00093 void KAddressBookMain::exit() 00094 { 00095 close(); 00096 } 00097 00098 bool KAddressBookMain::handleCommandLine() 00099 { 00100 return mCore->handleCommandLine( this ); 00101 } 00102 00103 void KAddressBookMain::saveProperties( KConfig* ) 00104 { 00105 } 00106 00107 void KAddressBookMain::readProperties( KConfig* ) 00108 { 00109 } 00110 00111 void KAddressBookMain::initActions() 00112 { 00113 KStdAction::quit( this, SLOT( close() ), actionCollection() ); 00114 00115 KAction *action; 00116 action = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 00117 action->setWhatsThis( i18n( "You will be presented with a dialog, where you can configure the application wide shortcuts." ) ); 00118 00119 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); 00120 } 00121 00122 void KAddressBookMain::configureKeyBindings() 00123 { 00124 KKeyDialog::configure( actionCollection(), this ); 00125 } 00126 00127 void KAddressBookMain::configureToolbars() 00128 { 00129 saveMainWindowSettings( KGlobal::config(), "MainWindow" ); 00130 00131 KEditToolbar edit( factory() ); 00132 connect( &edit, SIGNAL( newToolbarConfig() ), 00133 this, SLOT( slotNewToolbarConfig() ) ); 00134 00135 edit.exec(); 00136 } 00137 00138 void KAddressBookMain::newToolbarConfig() 00139 { 00140 createGUI(); 00141 applyMainWindowSettings( KGlobal::config(), "MainWindow" ); 00142 } 00143 00144 #include "kaddressbookmain.moc"
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:37 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003