summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp40
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h2
3 files changed, 30 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index cba5850..cd833cf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -3,192 +3,193 @@
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.
Async 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.
*/
/*s
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>
#include <kfiledialog.h>
#include <qtimer.h>
#include <qlabel.h>
#include <qregexp.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qprogressbar.h>
#include <libkdepim/phoneaccess.h>
#ifndef KAB_EMBEDDED
#include <qclipboard.h>
#include <qdir.h>
#include <qfile.h>
#include <qapplicaton.h>
#include <qprogressbar.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>
#include "addresseeutil.h"
#include "addresseeeditordialog.h"
#include "extensionmanager.h"
#include "kstdaction.h"
#include "kaddressbookservice.h"
#include "ldapsearchdialog.h"
#include "printing/printingwizard.h"
#else // KAB_EMBEDDED
#include <kapplication.h>
#include "KDGanttMinimizeSplitter.h"
#include "kaddressbookmain.h"
#include "kactioncollection.h"
#include "addresseedialog.h"
//US
#include <addresseeview.h>
#include <qapp.h>
#include <qmenubar.h>
//#include <qtoolbar.h>
#include <qmessagebox.h>
#include <kdebug.h>
#include <kiconloader.h> // needed for SmallIcon
#include <kresources/kcmkresources.h>
#include <ktoolbar.h>
+#include <kprefsdialog.h>
//#include <qlabel.h>
#ifndef DESKTOP_VERSION
#include <qpe/ir.h>
#include <qpe/qpemenubar.h>
#include <qtopia/qcopenvelope_qws.h>
#else
#include <qmenubar.h>
#endif
#endif // KAB_EMBEDDED
#include "kcmconfigs/kcmkabconfig.h"
#include "kcmconfigs/kcmkdepimconfig.h"
#include "kpimglobalprefs.h"
#include "externalapphandler.h"
#include "xxportselectdialog.h"
#include <kresources/selectdialog.h>
#include <kmessagebox.h>
#include <picture.h>
#include <resource.h>
//US#include <qsplitter.h>
#include <qmap.h>
#include <qdir.h>
#include <qfile.h>
#include <qvbox.h>
#include <qlayout.h>
#include <qclipboard.h>
#include <qtextstream.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/categoryeditdialog.h>
#include <kabc/vcardconverter.h>
#include "addresseeutil.h"
#include "undocmds.h"
#include "addresseeeditordialog.h"
#include "viewmanager.h"
#include "details/detailsviewcontainer.h"
#include "kabprefs.h"
#include "xxportmanager.h"
#include "incsearchwidget.h"
#include "jumpbuttonbar.h"
#include "extensionmanager.h"
#include "addresseeconfig.h"
#include "nameeditdialog.h"
#include <kcmultidialog.h>
#ifdef _WIN32_
#ifdef _OL_IMPORT_
#include "kaimportoldialog.h"
#endif
#else
#include <unistd.h>
#endif
// sync includes
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/ksyncprefsdialog.h>
class KABCatPrefs : public QDialog
{
public:
KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Manage new Categories") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
lay->addWidget( lab );
QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
addCatBut = new QRadioButton(i18n("Add to category list"), format );
new QRadioButton(i18n("Remove from addressees"), format );
addCatBut->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
@@ -1518,207 +1519,218 @@ void KABCore::setDetailsVisible( bool visible )
}
void KABCore::extensionChanged( int id )
{
//change the details view only for non desktop systems
#ifndef DESKTOP_VERSION
if (id == 0)
{
//the user disabled the extension.
if (mMultipleViewsAtOnce)
{ // enable detailsview again
setDetailsVisible( true );
mActionDetails->setChecked( true );
}
else
{ //go back to the listview
setDetailsVisible( false );
mActionDetails->setChecked( false );
mActionDetails->setEnabled(true);
}
}
else
{
//the user enabled the extension.
setDetailsVisible( false );
mActionDetails->setChecked( false );
if (!mMultipleViewsAtOnce)
{
mActionDetails->setEnabled(false);
}
mExtensionManager->setSelectionChanged();
}
#endif// DESKTOP_VERSION
}
void KABCore::extensionModified( const KABC::Addressee::List &list )
{
if ( list.count() != 0 ) {
KABC::Addressee::List::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it )
mAddressBook->insertAddressee( *it );
if ( list.count() > 1 )
setModified();
else
setModifiedWOrefresh();
}
if ( list.count() == 0 )
mViewManager->refreshView();
else
mViewManager->refreshView( list[ 0 ].uid() );
}
QString KABCore::getNameByPhone( const QString &phone )
{
#ifndef KAB_EMBEDDED
QRegExp r( "[/*/-/ ]" );
QString localPhone( phone );
bool found = false;
QString ownerName = "";
KABC::AddressBook::Iterator iter;
KABC::PhoneNumber::List::Iterator phoneIter;
KABC::PhoneNumber::List phoneList;
for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
phoneList = (*iter).phoneNumbers();
for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
++phoneIter) {
// Get rid of separator chars so just the numbers are compared.
if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
ownerName = (*iter).formattedName();
found = true;
}
}
}
return ownerName;
#else //KAB_EMBEDDED
qDebug("KABCore::getNameByPhone finsih method");
return "";
#endif //KAB_EMBEDDED
}
-
+void KABCore::openConfigGlobalDialog()
+{
+ KPimPrefsGlobalDialog gc ( this );
+ gc.exec();
+}
void KABCore::openConfigDialog()
{
- KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
- KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
- ConfigureDialog->addModule(kabcfg );
- KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
- ConfigureDialog->addModule(kdelibcfg );
+ KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true);
+ KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" );
+ ConfigureDialog->setMainWidget( kabcfg );
connect( ConfigureDialog, SIGNAL( applyClicked() ),
this, SLOT( configurationChanged() ) );
+ connect( ConfigureDialog, SIGNAL( applyClicked() ),
+ kabcfg, SLOT( save() ) );
connect( ConfigureDialog, SIGNAL( okClicked() ),
this, SLOT( configurationChanged() ) );
+ connect( ConfigureDialog, SIGNAL( okClicked() ),
+ kabcfg, SLOT( save() ) );
+ connect( ConfigureDialog, SIGNAL( defaultClicked() ),
+ kabcfg, SLOT( defaults() ) );
saveSettings();
+ kabcfg->load();
#ifndef DESKTOP_VERSION
+ if ( QApplication::desktop()->height() <= 480 )
+ ConfigureDialog->hideButtons();
ConfigureDialog->showMaximized();
#endif
if ( ConfigureDialog->exec() )
KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
delete ConfigureDialog;
}
void KABCore::openLDAPDialog()
{
#ifndef KAB_EMBEDDED
if ( !mLdapSearchDialog ) {
mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
SLOT( refreshView() ) );
connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
SLOT( setModified() ) );
} else
mLdapSearchDialog->restoreSettings();
if ( mLdapSearchDialog->isOK() )
mLdapSearchDialog->exec();
#else //KAB_EMBEDDED
qDebug("KABCore::openLDAPDialog() finsih method");
#endif //KAB_EMBEDDED
}
void KABCore::print()
{
#ifndef KAB_EMBEDDED
KPrinter printer;
if ( !printer.setup( this ) )
return;
KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
mViewManager->selectedUids(), this );
wizard.exec();
#else //KAB_EMBEDDED
qDebug("KABCore::print() finsih method");
#endif //KAB_EMBEDDED
}
void KABCore::addGUIClient( KXMLGUIClient *client )
{
if ( mGUIClient )
mGUIClient->insertChildClient( client );
else
KMessageBox::error( this, "no KXMLGUICLient");
}
void KABCore::configurationChanged()
{
mExtensionManager->reconfigure();
}
void KABCore::addressBookChanged()
{
/*US
QDictIterator<AddresseeEditorDialog> it( mEditorDict );
while ( it.current() ) {
if ( it.current()->dirty() ) {
QString text = i18n( "Data has been changed externally. Unsaved "
"changes will be lost." );
KMessageBox::information( this, text );
}
it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
++it;
}
*/
if (mEditorDialog)
{
if (mEditorDialog->dirty())
{
QString text = i18n( "Data has been changed externally. Unsaved "
"changes will be lost." );
KMessageBox::information( this, text );
}
QString currentuid = mEditorDialog->addressee().uid();
mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
}
mViewManager->refreshView();
}
AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
if ( mEditorDialog == 0 ) {
mEditorDialog = new AddresseeEditorDialog( this, parent,
name ? name : "editorDialog" );
@@ -1932,198 +1944,199 @@ void KABCore::initActions()
SLOT( newContact() ), actionCollection(), "file_new_contact" );
mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
this, SLOT( mailVCard() ),
actionCollection(), "file_mail_vcard");
mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
SLOT( export2phone() ), actionCollection(),
"kaddressbook_ex2phone" );
mActionBeamVCard = 0;
mActionBeam = 0;
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) {
mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
SLOT( beamVCard() ), actionCollection(),
"kaddressbook_beam_vcard" );
mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
SLOT( beamMySelf() ), actionCollection(),
"kaddressbook_beam_myself" );
}
#endif
mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
this, SLOT( editContact2() ),
actionCollection(), "file_properties" );
#ifdef KAB_EMBEDDED
// mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
mMainWindow, SLOT( exit() ),
actionCollection(), "quit" );
#endif //KAB_EMBEDDED
// edit menu
if ( mIsPart ) {
mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
SLOT( copyContacts() ), actionCollection(),
"kaddressbook_copy" );
mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
SLOT( cutContacts() ), actionCollection(),
"kaddressbook_cut" );
mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
SLOT( pasteContacts() ), actionCollection(),
"kaddressbook_paste" );
mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
SLOT( selectAllContacts() ), actionCollection(),
"kaddressbook_select_all" );
mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
SLOT( undo() ), actionCollection(),
"kaddressbook_undo" );
mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
this, SLOT( redo() ), actionCollection(),
"kaddressbook_redo" );
} else {
mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
}
mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
Key_Delete, this, SLOT( deleteContacts() ),
actionCollection(), "edit_delete" );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
// settings menu
#ifdef KAB_EMBEDDED
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
SLOT( configureResources() ), actionCollection(),
"kaddressbook_configure_resources" );
#endif //KAB_EMBEDDED
if ( mIsPart ) {
mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
SLOT( openConfigDialog() ), actionCollection(),
"kaddressbook_configure" );
//US not implemented yet
//mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
// this, SLOT( configureKeyBindings() ), actionCollection(),
// "kaddressbook_configure_shortcuts" );
#ifdef KAB_EMBEDDED
mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
mActionConfigureToolbars->setEnabled( false );
#endif //KAB_EMBEDDED
} else {
- mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
-
- //US not implemented yet
- //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
+ mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this,
+ SLOT( openConfigDialog() ), actionCollection(),
+ "kaddressbook_configure" );
+ mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this,
+ SLOT( openConfigGlobalDialog() ), actionCollection(),
+ "kaddressbook_configure" );
}
-
mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
actionCollection(), "options_show_jump_bar" );
connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
actionCollection(), "options_show_details" );
connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
SLOT( toggleBeamReceive() ), actionCollection(),
"kaddressbook_beam_rec" );
// 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 for Contacts..." ), 0, this,
SLOT( setCategories() ), actionCollection(),
"edit_set_categories" );
mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
SLOT( editCategories() ), actionCollection(),
"edit__categories" );
mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
SLOT( removeVoice() ), actionCollection(),
"remove_voice" );
mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
SLOT( setFormattedName() ), actionCollection(),
"set_formatted" );
mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
SLOT( manageCategories() ), actionCollection(),
"remove_voice" );
mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
SLOT( importFromOL() ), actionCollection(),
"import_OL" );
#ifdef KAB_EMBEDDED
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" );
mActionWN = new KAction( i18n( "What's New?" ), 0,
this, SLOT( whatsnew() ), actionCollection(),
"wn" );
mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0,
this, SLOT( storagehowto() ), actionCollection(),
"storage" );
mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
this, SLOT( synchowto() ), actionCollection(),
"sync" );
mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
this, SLOT( kdesynchowto() ), actionCollection(),
"kdesync" );
mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
this, SLOT( multisynchowto() ), actionCollection(),
"multisync" );
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);
@@ -2150,194 +2163,195 @@ void KABCore::addActionsManually()
mb->insertItem( i18n("Synchronize"), syncMenu );
#else
mb->insertItem( i18n("Sync"), syncMenu );
#endif
//mb->insertItem( i18n("&Change"), changeMenu );
mb->insertItem( i18n("&Help"), helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget);
#ifndef DESKTOP_VERSION
} else {
//US setup toolbar
QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
QPopupMenu *popupBarTB = new QPopupMenu( this );
menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
tb->insertWidget(-1, 0, menuBarTB);
mIncSearchWidget = new IncSearchWidget( tb );
tb->enableMoving(false);
popupBarTB->insertItem( i18n("&File"), fileMenu );
popupBarTB->insertItem( i18n("&Edit"), editMenu );
popupBarTB->insertItem( i18n("&View"), viewMenu );
popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
//popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
popupBarTB->insertItem( i18n("&Help"), helpMenu );
if (QApplication::desktop()->width() > 320 ) {
// mViewManager->getFilterAction()->plug ( tb);
}
}
#endif
mIncSearchWidget->setSize();
// mActionQuit->plug ( mMainWindow->toolBar());
//US Now connect the actions with the menue entries.
#ifdef DESKTOP_VERSION
mActionPrint->plug( fileMenu );
mActionPrintDetails->plug( fileMenu );
fileMenu->insertSeparator();
#endif
mActionMail->plug( fileMenu );
fileMenu->insertSeparator();
mActionNewContact->plug( editMenu );
mActionNewContact->plug( tb );
mActionEditAddressee->plug( editMenu );
editMenu->insertSeparator();
// if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
// (!KABPrefs::instance()->mMultipleViewsAtOnce ))
mActionEditAddressee->plug( tb );
// fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Export", ExportMenu );
editMenu->insertItem( i18n("&Change"), changeMenu );
editMenu->insertSeparator();
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
#endif
#if 0
// PENDING fix MailVCard
fileMenu->insertSeparator();
mActionMailVCard->plug( fileMenu );
#endif
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug( beamMenu );
if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
if ( Ir::supported() ) mActionBeam->plug( beamMenu );
#endif
fileMenu->insertSeparator();
mActionQuit->plug( fileMenu );
#ifdef _OL_IMPORT_
mActionImportOL->plug( ImportMenu );
#endif
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
mActionCopy->plug( editMenu );
mActionPaste->plug( editMenu );
mActionDelete->plug( editMenu );
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
mActionSetFormattedName->plug( changeMenu );
mActionRemoveVoice->plug( changeMenu );
// settingsmings menu
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
// settingsMenu->insertSeparator();
mActionConfigKAddressbook->plug( settingsMenu, 0 );
- mActionConfigResources->plug( settingsMenu,1 );
- settingsMenu->insertSeparator(2);
+ mActionConfigGlobal->plug( settingsMenu, 1 );
+ mActionConfigResources->plug( settingsMenu,2 );
+ settingsMenu->insertSeparator(3);
if ( mIsPart ) {
//US not implemented yet
//mActionConfigShortcuts->plug( settingsMenu );
//mActionConfigureToolbars->plug( settingsMenu );
} else {
//US not implemented yet
//mActionKeyBindings->plug( settingsMenu );
}
mActionEditCategories->plug( settingsMenu );
mActionManageCategories->plug( settingsMenu );
mActionJumpBar->plug( viewMenu,0 );
mActionDetails->plug( viewMenu,0 );
//if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug(settingsMenu );
settingsMenu->insertSeparator();
#endif
mActionWhoAmI->plug( settingsMenu );
//mActionEditCategories->plug( changeMenu );
mActionCategories->plug( changeMenu );
//mActionManageCategories->plug( changeMenu );
//mActionCategories->plug( settingsMenu );
mActionWN->plug( helpMenu );
mActionStorageHowto->plug( helpMenu );
mActionSyncHowto->plug( helpMenu );
mActionKdeSyncHowto->plug( helpMenu );
mActionMultiSyncHowto->plug( helpMenu );
mActionFaq->plug( helpMenu );
mActionLicence->plug( helpMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (KGlobal::getDesktopSize() > KGlobal::Small ) {
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
//LR hide filteraction on started in 480x640
if (QApplication::desktop()->width() == 480 ) {
mViewManager->getFilterAction()->setComboWidth( 0 );
}
mActionUndo->plug( tb );
mActionDelete->plug( tb );
mActionRedo->plug( tb );
} else {
mActionSave->plug( tb );
tb->enableMoving(false);
}
//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
mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
void KABCore::manageCategories( )
{
KABCatPrefs* cp = new KABCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 80dbf08..6479a58 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -234,295 +234,297 @@ class KABCore : public QWidget, public KSyncInterface
Sets the whoAmI contact, that is used by many other programs to
get personal information about the current user.
*/
void setWhoAmI();
/**
Displays the category dialog and applies the result to all
selected contacts.
*/
void setCategories();
void manageCategories();
void editCategories();
/**
Sets the field list of the Incremental Search Widget.
*/
void setSearchFields( const KABC::Field::List &fields );
/**
Search with the current search field for a contact, that matches
the given text, and selects it in the view.
*/
void incrementalSearch( const QString& text );
void incrementalSearchJump( const QString& text );
/**
Marks the address book as modified.
*/
void setModified();
/**
Marks the address book as modified without refreshing the view.
*/
void setModifiedWOrefresh();
/**
Marks the address book as modified concerning the argument.
*/
void setModified( bool modified );
/**
Returns whether the address book is modified.
*/
bool modified() const;
/**
Called whenever an contact is modified in the contact editor
dialog or the quick edit.
*/
void contactModified( const KABC::Addressee &addr );
void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
/**
DCOP METHODS.
*/
void addEmail( QString addr );
void importVCard( const KURL& url, bool showPreview );
void importVCard( const QString& vCard, bool showPreview );
void newContact();
QString getNameByPhone( const QString& phone );
/**
END DCOP METHODS
*/
/**
Saves the contents of the AddressBook back to disk.
*/
void save();
/**
Undos the last command using the undo stack.
*/
void undo();
/**
Redos the last command that was undone, using the redo stack.
*/
void redo();
/**
Shows the edit dialog for the given uid. If the uid is QString::null,
the method will try to find a selected addressee in the view.
*/
void editContact( const QString &uid /*US = QString::null*/ );
//US added a second method without defaultparameter
void editContact2();
/**
Shows or edits the detail view for the given uid. If the uid is QString::null,
the method will try to find a selected addressee in the view.
*/
void executeContact( const QString &uid /*US = QString::null*/ );
/**
Launches the configuration dialog.
*/
void openConfigDialog();
+ void openConfigGlobalDialog();
/**
Launches the ldap search dialog.
*/
void openLDAPDialog();
/**
Creates a KAddressBookPrinter, which will display the print
dialog and do the printing.
*/
void print();
/**
Registers a new GUI client, so plugins can register its actions.
*/
void addGUIClient( KXMLGUIClient *client );
void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
signals:
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
void recieve(QString cmsg );
void getFile( bool success );
void syncFileRequest();
void setDetailsVisible( bool visible );
void setDetailsToState();
void saveSettings();
private slots:
void updateToolBar();
void updateMainWindow();
void receive( const QCString& cmsg, const QByteArray& data );
void toggleBeamReceive( );
void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
void setJumpButtonBar( bool visible );
void setCaptionBack();
void resizeAndCallContactdialog();
void callContactdialog();
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
void setFormattedName();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
QString mEmailSourceChannel;
QString mEmailSourceUID;
void resizeEvent(QResizeEvent* e );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
QTimer *mMessageTimer;
void initGUI();
void initActions();
QString getPhoneFile();
AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
const char *name = 0 );
KXMLGUIClient *mGUIClient;
KABC::AddressBook *mAddressBook;
ViewManager *mViewManager;
// QSplitter *mDetailsSplitter;
KDGanttMinimizeSplitter *mExtensionBarSplitter;
ViewContainer *mDetails;
KDGanttMinimizeSplitter* mMiniSplitter;
XXPortManager *mXXPortManager;
JumpButtonBar *mJumpButtonBar;
IncSearchWidget *mIncSearchWidget;
ExtensionManager *mExtensionManager;
KCMultiDialog *mConfigureDialog;
#ifndef KAB_EMBEDDED
LDAPSearchDialog *mLdapSearchDialog;
#endif //KAB_EMBEDDED
// QDict<AddresseeEditorDialog> mEditorDict;
AddresseeEditorDialog *mEditorDialog;
bool mReadWrite;
bool mModified;
bool mIsPart;
bool mMultipleViewsAtOnce;
//US file menu
KAction *mActionMail;
KAction *mActionBeam;
KToggleAction *mActionBR;
KAction *mActionExport2phone;
KAction* mActionPrint;
KAction* mActionPrintDetails;
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 *mActionConfigGlobal;
KAction *mActionConfigKAddressbook;
KAction *mActionConfigShortcuts;
KAction *mActionConfigureToolbars;
KAction *mActionKeyBindings;
KToggleAction *mActionJumpBar;
KToggleAction *mActionDetails;
KAction *mActionWhoAmI;
KAction *mActionCategories;
KAction *mActionEditCategories;
KAction *mActionManageCategories;
KAction *mActionAboutKAddressbook;
KAction *mActionLicence;
KAction *mActionFaq;
KAction *mActionWN;
KAction *mActionSyncHowto;
KAction *mActionStorageHowto;
KAction *mActionKdeSyncHowto;
KAction *mActionMultiSyncHowto;
KAction *mActionDeleteView;
QPopupMenu *viewMenu;
QPopupMenu *filterMenu;
QPopupMenu *settingsMenu;
QPopupMenu *changeMenu;
QPopupMenu *beamMenu;
//US QAction *mActionSave;
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
//LR additional methods
KAction *mActionRemoveVoice;
KAction *mActionSetFormattedName;
KAction * mActionImportOL;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;
#endif //KAB_EMBEDDED
class KABCorePrivate;
KABCorePrivate *d;
//US bool mBlockSaveFlag;
#ifdef KAB_EMBEDDED
KAddressBookMain *mMainWindow; // should be the same like mGUIClient
#endif //KAB_EMBEDDED
//this are the overwritten callbackmethods from the syncinterface
virtual bool sync(KSyncManager* manager, QString filename, int mode);
virtual bool syncExternal(KSyncManager* manager, QString resource);
virtual void removeSyncInfo( QString syncProfile);
bool syncPhone();
void message( QString m , bool startTimer = true);
// LR *******************************
// sync stuff!
QString sentSyncFile();
QPopupMenu *syncMenu;
KSyncManager* syncManager;
int mGlobalSyncMode;
bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
KABC::Addressee getLastSyncAddressee();
QDateTime mLastAddressbookSync;
int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
// *********************
};
#endif
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h
index 2ecbfef..2af10d7 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.h
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.h
@@ -1,47 +1,47 @@
/*
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.
*/
#ifndef KCMKABCONFIG_H
#define KCMKABCONFIG_H
#include <kcmodule.h>
class KABConfigWidget;
class KABPrefs;
class KCMKabConfig : public KCModule
{
Q_OBJECT
public:
KCMKabConfig( QWidget *parent = 0, const char *name = 0 );
-
+ public slots:
virtual void load();
virtual void save();
virtual void defaults();
private:
KABConfigWidget *mConfigWidget;
};
#endif