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 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 );
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"