• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kaddressbook

kaddressbookmain.cpp

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <kshortcutsdialog.h>
00026 #include <kglobal.h>
00027 #include <klocale.h>
00028 #include <kmessagebox.h>
00029 #include <kstatusbar.h>
00030 #include <kstandardaction.h>
00031 #include <kactioncollection.h>
00032 
00033 #include <libkdepim/statusbarprogresswidget.h>
00034 #include <libkdepim/progressdialog.h>
00035 
00036 #include "kaddressbookadaptor.h"
00037 
00038 #include "kabcore.h"
00039 
00040 #include "kaddressbookmain.h"
00041 
00042 KAddressBookMain::KAddressBookMain( const QString &file )
00043   : KXmlGuiWindow( 0 )
00044 {
00045   // Set this to be the group leader for all subdialogs - this means
00046   // modal subdialogs will only affect this dialog, not the other windows
00047   setAttribute( Qt::WA_GroupLeader );
00048 
00049   setCaption( i18n( "Address Book Browser" ) );
00050 
00051   mCore = new KABCore( this, true, this, file );
00052   mCore->restoreSettings();
00053 
00054   initActions();
00055 
00056   setCentralWidget( mCore->widget() );
00057 
00058   statusBar()->show();
00059   statusBar()->insertItem( "", 1 );
00060 
00061   KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(),
00062     this );
00063   progressDialog->hide();
00064 
00065   KPIM::StatusbarProgressWidget *progressWidget;
00066   progressWidget = new KPIM::StatusbarProgressWidget( progressDialog,
00067     statusBar() );
00068   progressWidget->show();
00069 
00070   statusBar()->addPermanentWidget( progressWidget, 0 );
00071 
00072   mCore->setStatusBar( statusBar() );
00073 
00074   setStandardToolBarMenuEnabled( true );
00075 
00076   createGUI( "kaddressbookui.rc" );
00077 
00078   resize( 400, 300 ); // initial size
00079   setAutoSaveSettings();
00080 
00081   new CoreAdaptor( this );
00082   QDBusConnection::sessionBus().registerObject("/KAddressBook", this, QDBusConnection::ExportAdaptors);
00083 }
00084 
00085 KAddressBookMain::~KAddressBookMain()
00086 {
00087   mCore->saveSettings();
00088 }
00089 
00090 void KAddressBookMain::addEmail( QString addr )
00091 {
00092   mCore->addEmail( addr );
00093 }
00094 
00095 void KAddressBookMain::importVCard( const KUrl& url )
00096 {
00097   mCore->importVCard( url );
00098 }
00099 
00100 void KAddressBookMain::importVCardFromData( const QString& vCard )
00101 {
00102   mCore->importVCardFromData( vCard );
00103 }
00104 
00105 void KAddressBookMain::showContactEditor( QString uid )
00106 {
00107   mCore->editContact( uid );
00108 }
00109 
00110 void KAddressBookMain::newDistributionList()
00111 {
00112   mCore->newDistributionList();
00113 }
00114 
00115 void KAddressBookMain::newContact()
00116 {
00117   mCore->newContact();
00118 }
00119 
00120 QString KAddressBookMain::getNameByPhone( QString phone )
00121 {
00122   return mCore->getNameByPhone( phone );
00123 }
00124 
00125 void KAddressBookMain::save()
00126 {
00127   mCore->save();
00128 }
00129 
00130 void KAddressBookMain::exit()
00131 {
00132   close();
00133 }
00134 
00135 bool KAddressBookMain::handleCommandLine()
00136 {
00137   return mCore->handleCommandLine();
00138 }
00139 
00140 void KAddressBookMain::saveProperties( KConfigGroup& )
00141 {
00142 }
00143 
00144 void KAddressBookMain::readProperties( const KConfigGroup& )
00145 {
00146 }
00147 
00148 bool KAddressBookMain::queryClose()
00149 {
00150   return mCore->queryClose();
00151 }
00152 
00153 void KAddressBookMain::initActions()
00154 {
00155   KStandardAction::quit( this, SLOT( close() ), actionCollection() );
00156 
00157   KAction *action;
00158   action = KStandardAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
00159   action->setWhatsThis( i18n( "You will be presented with a dialog, where you can configure the application wide shortcuts." ) );
00160 
00161   KStandardAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
00162 }
00163 
00164 void KAddressBookMain::configureKeyBindings()
00165 {
00166   KShortcutsDialog::configure( actionCollection(), KShortcutsEditor::LetterShortcutsAllowed, this );
00167 }
00168 
00169 void KAddressBookMain::configureToolbars()
00170 {
00171   saveMainWindowSettings( KGlobal::config()->group( "MainWindow" ) );
00172 
00173   KEditToolBar edit( factory() );
00174   connect( &edit, SIGNAL( newToolbarConfig() ),
00175            this, SLOT( newToolbarConfig() ) );
00176 
00177   edit.exec();
00178 }
00179 
00180 void KAddressBookMain::newToolbarConfig()
00181 {
00182   createGUI( "kaddressbookui.rc" );
00183   applyMainWindowSettings( KGlobal::config()->group( "MainWindow" ) );
00184 }
00185 
00186 #include "kaddressbookmain.moc"

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal