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