-rw-r--r-- | kaddressbook/kabcore.cpp | 33 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 3 |
2 files changed, 29 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index dabb8e9..cb9b992 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1,55 +1,62 @@ /* This file is part of KAddressbook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ +/* +Enhanced Version of the file for platform independent KDE tools. +Copyright (c) 2004 Ulf Schenk + +$Id$ +*/ + #include "kabcore.h" #include <stdaddressbook.h> #include <klocale.h> #ifndef KAB_EMBEDDED #include <qclipboard.h> #include <qdir.h> #include <qfile.h> #include <qapplicaton.h> #include <qlayout.h> #include <qregexp.h> #include <qvbox.h> #include <kabc/addresseelist.h> #include <kabc/errorhandler.h> #include <kabc/resource.h> #include <kabc/vcardconverter.h> #include <kapplication.h> #include <kactionclasses.h> #include <kcmultidialog.h> #include <kdebug.h> #include <kdeversion.h> #include <kkeydialog.h> #include <kmessagebox.h> #include <kprinter.h> #include <kprotocolinfo.h> #include <kresources/selectdialog.h> #include <kstandarddirs.h> #include <ktempfile.h> #include <kxmlguiclient.h> #include <kaboutdata.h> #include <libkdepim/categoryselectdialog.h> @@ -389,75 +396,76 @@ void KABCore::createAboutData() KAboutData::License_GPL_V2, I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); about->addAuthor( "Cornelius Schumacher", I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), "schumacher@kde.org" ); about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), "mpilone@slac.com" ); about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), "michel@klaralvdalens-datakonsult.se" ); about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), "hansen@kde.org" ); return about; #endif //KAB_EMBEDDED QString version; #include <../version> QMessageBox::about( this, "About KAddressbook/Pi", "KAddressbook/Platform-independent\n" "(KA/Pi) " +version + " - " + #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\n" "for: Zaurus 5500 / 7x0 / 8x0\n" #endif "(c) 2004 Ulf Schenk\n" + "(c) 2004 Lutz Rogowski\n" "(c) 1997-2003, The KDE PIM Team\n" - "Tobias Koenig Current maintainer tokoe@kde.org\n" + "Tobias Koenig Current maintainer\ntokoe@kde.org\n" "Don Sanders Original author\n" - "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" - "Mike Pilone GUI and framework redesign mpilone@slac.com\n" + "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" + "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" "Greg Stern DCOP interface\n" "Mark Westcot Contact pinning\n" "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" - "Steffen Hansen LDAP Lookup hansen@kde.org\n" + "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" #ifdef _WIN32_ - "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" + "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" #endif ); } void KABCore::setContactSelected( const QString &uid ) { KABC::Addressee addr = mAddressBook->findByUid( uid ); if ( !mDetails->isHidden() ) mDetails->setAddressee( addr ); if ( !addr.isEmpty() ) { emit contactSelected( addr.formattedName() ); KABC::Picture pic = addr.photo(); if ( pic.isIntern() ) { //US emit contactSelected( pic.data() ); //US instead use: QPixmap px; if (pic.data().isNull() != true) { px.convertFromImage(pic.data()); } emit contactSelected( px ); } } mExtensionManager->setSelectionChanged(); // update the actions bool selected = !uid.isEmpty(); @@ -1705,67 +1713,71 @@ void KABCore::initActions() // misc // only enable LDAP lookup if we can handle the protocol #ifndef KAB_EMBEDDED if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, this, SLOT( openLDAPDialog() ), actionCollection(), "ldap_lookup" ); } #else //KAB_EMBEDDED //qDebug("KABCore::initActions() LDAP has to be implemented"); #endif //KAB_EMBEDDED mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, SLOT( setWhoAmI() ), actionCollection(), "set_personal" ); mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, SLOT( setCategories() ), actionCollection(), "edit_set_categories" ); mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, SLOT( removeVoice() ), actionCollection(), "remove_voice" ); mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, SLOT( importFromOL() ), actionCollection(), "import_OL" ); #ifdef KAB_EMBEDDED - mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, + mActionLicence = new KAction( i18n( "Licence" ), 0, this, SLOT( showLicence() ), actionCollection(), "licence_about_data" ); + mActionFaq = new KAction( i18n( "Faq" ), 0, + this, SLOT( faq() ), actionCollection(), + "faq_about_data" ); + mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, this, SLOT( createAboutData() ), actionCollection(), "kaddressbook_about_data" ); #endif //KAB_EMBEDDED clipboardDataChanged(); connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); } //US we need this function, to plug all actions into the correct menues. // KDE uses a XML format to plug the actions, but we work her without this overhead. void KABCore::addActionsManually() { //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); #ifdef KAB_EMBEDDED QPopupMenu *fileMenu = new QPopupMenu( this ); QPopupMenu *editMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); KToolBar* tb = mMainWindow->toolBar(); #ifdef DESKTOP_VERSION QMenuBar* mb = mMainWindow->menuBar(); //US setup menubar. //Disable the following block if you do not want to have a menubar. mb->insertItem( "&File", fileMenu ); mb->insertItem( "&Edit", editMenu ); mb->insertItem( "&View", viewMenu ); mb->insertItem( "&Settings", settingsMenu ); @@ -1836,66 +1848,67 @@ void KABCore::addActionsManually() mActionDelete->plug( editMenu ); editMenu->insertSeparator(); mActionSelectAll->plug( editMenu ); mActionRemoveVoice->plug( changeMenu ); // settings menu //US special menuentry to configure the addressbook resources. On KDE // you do that through the control center !!! mActionConfigResources->plug( settingsMenu ); settingsMenu->insertSeparator(); mActionConfigKAddressbook->plug( settingsMenu ); if ( mIsPart ) { mActionConfigShortcuts->plug( settingsMenu ); mActionConfigureToolbars->plug( settingsMenu ); } else { mActionKeyBindings->plug( settingsMenu ); } settingsMenu->insertSeparator(); mActionJumpBar->plug( settingsMenu ); mActionDetails->plug( settingsMenu ); if (!KABPrefs::instance()->mMultipleViewsAtOnce ) mActionDetails->plug( tb ); settingsMenu->insertSeparator(); mActionWhoAmI->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); - mActionAboutKAddressbook->plug( helpMenu ); mActionLicence->plug( helpMenu ); + mActionFaq->plug( helpMenu ); + mActionAboutKAddressbook->plug( helpMenu ); if (KGlobal::getDesktopSize() > KGlobal::Small ) { mActionSave->plug( tb ); mViewManager->getFilterAction()->plug ( tb); if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { mActionUndo->plug( tb ); mActionDelete->plug( tb ); mActionRedo->plug( tb ); } } //mActionQuit->plug ( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget, 6); //US link the searchwidget first to this. // The real linkage to the toolbar happens later. //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); //US tb->insertItem( mIncSearchWidget ); /*US mIncSearchWidget = new IncSearchWidget( tb ); connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); mJumpButtonBar = new JumpButtonBar( this, this ); //US topLayout->addWidget( mJumpButtonBar ); this->layout()->add( mJumpButtonBar ); */ #endif //KAB_EMBEDDED } void KABCore::showLicence() @@ -2039,37 +2052,43 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses } } else { foundUid = uid; } if (!foundUid.isEmpty()) { // raise Ka/Pi if it is in the background #ifndef DESKTOP_VERSION #ifndef KORG_NODCOP QCopEnvelope e("QPE/Application/kapi", "raise()"); #endif #endif mMainWindow->showMaximized(); mViewManager->setSelected( "", false); mViewManager->refreshView( "" ); mViewManager->setSelected( foundUid, true ); mViewManager->refreshView( foundUid ); if ( !mMultipleViewsAtOnce ) { setDetailsVisible( true ); mActionDetails->setChecked(true); } } } +void KABCore::faq() +{ + KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); +} + + #ifndef KAB_EMBEDDED #include "kabcore.moc" #endif //KAB_EMBEDDED diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 040b6aa..39d043f 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -114,64 +114,66 @@ class KABCore : public QWidget Returns the current search field of the Incremental Search Widget. */ KABC::Field *currentSearchField() const; /** Returns the uid list of the currently selected contacts. */ QStringList selectedUIDs() const; /** Displays the ResourceSelectDialog and returns the selected resource or a null pointer if no resource was selected by the user. */ KABC::Resource *requestResource( QWidget *parent ); #ifndef KAB_EMBEDDED static KAboutData *createAboutData(); #endif //KAB_EMBEDDED #ifdef KAB_EMBEDDED inline QPopupMenu* getImportMenu() { return ImportMenu;} inline QPopupMenu* getExportMenu() { return ExportMenu;} #endif //KAB_EMBEDDED public slots: #ifdef KAB_EMBEDDED void createAboutData(); #endif //KAB_EMBEDDED void statusMessage(QString, int time = 0 ); void showLicence(); + void faq(); + /** Is called whenever a contact is selected in the view. */ void setContactSelected( const QString &uid ); /** Opens the preferred mail composer with all selected contacts as arguments. */ void sendMail(); /** Opens the preferred mail composer with the given contacts as arguments. */ void sendMail( const QString& email ); void mailVCard(); void mailVCard(const QStringList& uids); /** Beams the "WhoAmI contact. */ void beamMySelf(); void beamVCard(); void beamVCard(const QStringList& uids); void beamDone( Ir *ir ); /** @@ -393,61 +395,62 @@ class KABCore : public QWidget KAction *mActionMail; KAction *mActionBeam; KAction* mActionPrint; KAction* mActionNewContact; KAction *mActionSave; KAction *mActionEditAddressee; KAction *mActionMailVCard; KAction *mActionBeamVCard; KAction *mActionQuit; //US edit menu KAction *mActionCopy; KAction *mActionCut; KAction *mActionPaste; KAction *mActionSelectAll; KAction *mActionUndo; KAction *mActionRedo; KAction *mActionDelete; //US settings menu KAction *mActionConfigResources; KAction *mActionConfigKAddressbook; KAction *mActionConfigShortcuts; KAction *mActionConfigureToolbars; KAction *mActionKeyBindings; KToggleAction *mActionJumpBar; KToggleAction *mActionDetails; KAction *mActionWhoAmI; KAction *mActionCategories; KAction *mActionAboutKAddressbook; KAction *mActionLicence; + KAction *mActionFaq; KAction *mActionDeleteView; QPopupMenu *viewMenu; QPopupMenu *filterMenu; QPopupMenu *settingsMenu; QPopupMenu *changeMenu; //US QAction *mActionSave; QPopupMenu *ImportMenu; QPopupMenu *ExportMenu; //LR additional methods KAction *mActionRemoveVoice; KAction * mActionImportOL; #ifndef KAB_EMBEDDED KAddressBookService *mAddressBookService; #endif //KAB_EMBEDDED class KABCorePrivate; KABCorePrivate *d; #ifdef KAB_EMBEDDED KAddressBookMain *mMainWindow; // should be the same like mGUIClient #endif //KAB_EMBEDDED }; #endif |