kaddressbookmain.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 );
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"
This file is part of the documentation for kaddressbook Library Version 3.2.2.