summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp40
1 files changed, 27 insertions, 13 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 @@
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 Async a special exception, permission is given to link this program 19 Async a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99#include <kprefsdialog.h>
99 100
100 101
101//#include <qlabel.h> 102//#include <qlabel.h>
102 103
103 104
104#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 106#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 107#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 108#include <qtopia/qcopenvelope_qws.h>
108#else 109#else
109 110
110#include <qmenubar.h> 111#include <qmenubar.h>
111#endif 112#endif
112 113
113#endif // KAB_EMBEDDED 114#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 115#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 116#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 117#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 118#include "externalapphandler.h"
118#include "xxportselectdialog.h" 119#include "xxportselectdialog.h"
119 120
120 121
121#include <kresources/selectdialog.h> 122#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 123#include <kmessagebox.h>
123 124
124#include <picture.h> 125#include <picture.h>
125#include <resource.h> 126#include <resource.h>
126 127
127//US#include <qsplitter.h> 128//US#include <qsplitter.h>
128#include <qmap.h> 129#include <qmap.h>
129#include <qdir.h> 130#include <qdir.h>
130#include <qfile.h> 131#include <qfile.h>
131#include <qvbox.h> 132#include <qvbox.h>
132#include <qlayout.h> 133#include <qlayout.h>
133#include <qclipboard.h> 134#include <qclipboard.h>
134#include <qtextstream.h> 135#include <qtextstream.h>
135#include <qradiobutton.h> 136#include <qradiobutton.h>
136#include <qbuttongroup.h> 137#include <qbuttongroup.h>
137 138
138#include <libkdepim/categoryselectdialog.h> 139#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 140#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 141#include <kabc/vcardconverter.h>
141 142
142 143
143#include "addresseeutil.h" 144#include "addresseeutil.h"
144#include "undocmds.h" 145#include "undocmds.h"
145#include "addresseeeditordialog.h" 146#include "addresseeeditordialog.h"
146#include "viewmanager.h" 147#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 148#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 149#include "kabprefs.h"
149#include "xxportmanager.h" 150#include "xxportmanager.h"
150#include "incsearchwidget.h" 151#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 152#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 153#include "extensionmanager.h"
153#include "addresseeconfig.h" 154#include "addresseeconfig.h"
154#include "nameeditdialog.h" 155#include "nameeditdialog.h"
155#include <kcmultidialog.h> 156#include <kcmultidialog.h>
156 157
157#ifdef _WIN32_ 158#ifdef _WIN32_
158#ifdef _OL_IMPORT_ 159#ifdef _OL_IMPORT_
159#include "kaimportoldialog.h" 160#include "kaimportoldialog.h"
160#endif 161#endif
161#else 162#else
162#include <unistd.h> 163#include <unistd.h>
163#endif 164#endif
164// sync includes 165// sync includes
165#include <libkdepim/ksyncprofile.h> 166#include <libkdepim/ksyncprofile.h>
166#include <libkdepim/ksyncprefsdialog.h> 167#include <libkdepim/ksyncprefsdialog.h>
167 168
168 169
169class KABCatPrefs : public QDialog 170class KABCatPrefs : public QDialog
170{ 171{
171 public: 172 public:
172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 173 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
173 QDialog( parent, name, true ) 174 QDialog( parent, name, true )
174 { 175 {
175 setCaption( i18n("Manage new Categories") ); 176 setCaption( i18n("Manage new Categories") );
176 QVBoxLayout* lay = new QVBoxLayout( this ); 177 QVBoxLayout* lay = new QVBoxLayout( this );
177 lay->setSpacing( 3 ); 178 lay->setSpacing( 3 );
178 lay->setMargin( 3 ); 179 lay->setMargin( 3 );
179 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 ); 180 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 );
180 lay->addWidget( lab ); 181 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
182 lay->addWidget( format ); 183 lay->addWidget( format );
183 format->setExclusive ( true ) ; 184 format->setExclusive ( true ) ;
184 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 185 addCatBut = new QRadioButton(i18n("Add to category list"), format );
185 new QRadioButton(i18n("Remove from addressees"), format ); 186 new QRadioButton(i18n("Remove from addressees"), format );
186 addCatBut->setChecked( true ); 187 addCatBut->setChecked( true );
187 QPushButton * ok = new QPushButton( i18n("OK"), this ); 188 QPushButton * ok = new QPushButton( i18n("OK"), this );
188 lay->addWidget( ok ); 189 lay->addWidget( ok );
189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
190 lay->addWidget( cancel ); 191 lay->addWidget( cancel );
191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
193 resize( 200, 200 ); 194 resize( 200, 200 );
194 } 195 }
@@ -1518,207 +1519,218 @@ void KABCore::setDetailsVisible( bool visible )
1518 1519
1519} 1520}
1520 1521
1521void KABCore::extensionChanged( int id ) 1522void KABCore::extensionChanged( int id )
1522{ 1523{
1523 //change the details view only for non desktop systems 1524 //change the details view only for non desktop systems
1524#ifndef DESKTOP_VERSION 1525#ifndef DESKTOP_VERSION
1525 1526
1526 if (id == 0) 1527 if (id == 0)
1527 { 1528 {
1528 //the user disabled the extension. 1529 //the user disabled the extension.
1529 1530
1530 if (mMultipleViewsAtOnce) 1531 if (mMultipleViewsAtOnce)
1531 { // enable detailsview again 1532 { // enable detailsview again
1532 setDetailsVisible( true ); 1533 setDetailsVisible( true );
1533 mActionDetails->setChecked( true ); 1534 mActionDetails->setChecked( true );
1534 } 1535 }
1535 else 1536 else
1536 { //go back to the listview 1537 { //go back to the listview
1537 setDetailsVisible( false ); 1538 setDetailsVisible( false );
1538 mActionDetails->setChecked( false ); 1539 mActionDetails->setChecked( false );
1539 mActionDetails->setEnabled(true); 1540 mActionDetails->setEnabled(true);
1540 } 1541 }
1541 1542
1542 } 1543 }
1543 else 1544 else
1544 { 1545 {
1545 //the user enabled the extension. 1546 //the user enabled the extension.
1546 setDetailsVisible( false ); 1547 setDetailsVisible( false );
1547 mActionDetails->setChecked( false ); 1548 mActionDetails->setChecked( false );
1548 1549
1549 if (!mMultipleViewsAtOnce) 1550 if (!mMultipleViewsAtOnce)
1550 { 1551 {
1551 mActionDetails->setEnabled(false); 1552 mActionDetails->setEnabled(false);
1552 } 1553 }
1553 1554
1554 mExtensionManager->setSelectionChanged(); 1555 mExtensionManager->setSelectionChanged();
1555 1556
1556 } 1557 }
1557 1558
1558#endif// DESKTOP_VERSION 1559#endif// DESKTOP_VERSION
1559 1560
1560} 1561}
1561 1562
1562 1563
1563void KABCore::extensionModified( const KABC::Addressee::List &list ) 1564void KABCore::extensionModified( const KABC::Addressee::List &list )
1564{ 1565{
1565 1566
1566 if ( list.count() != 0 ) { 1567 if ( list.count() != 0 ) {
1567 KABC::Addressee::List::ConstIterator it; 1568 KABC::Addressee::List::ConstIterator it;
1568 for ( it = list.begin(); it != list.end(); ++it ) 1569 for ( it = list.begin(); it != list.end(); ++it )
1569 mAddressBook->insertAddressee( *it ); 1570 mAddressBook->insertAddressee( *it );
1570 if ( list.count() > 1 ) 1571 if ( list.count() > 1 )
1571 setModified(); 1572 setModified();
1572 else 1573 else
1573 setModifiedWOrefresh(); 1574 setModifiedWOrefresh();
1574 } 1575 }
1575 if ( list.count() == 0 ) 1576 if ( list.count() == 0 )
1576 mViewManager->refreshView(); 1577 mViewManager->refreshView();
1577 else 1578 else
1578 mViewManager->refreshView( list[ 0 ].uid() ); 1579 mViewManager->refreshView( list[ 0 ].uid() );
1579 1580
1580 1581
1581 1582
1582} 1583}
1583 1584
1584QString KABCore::getNameByPhone( const QString &phone ) 1585QString KABCore::getNameByPhone( const QString &phone )
1585{ 1586{
1586#ifndef KAB_EMBEDDED 1587#ifndef KAB_EMBEDDED
1587 QRegExp r( "[/*/-/ ]" ); 1588 QRegExp r( "[/*/-/ ]" );
1588 QString localPhone( phone ); 1589 QString localPhone( phone );
1589 1590
1590 bool found = false; 1591 bool found = false;
1591 QString ownerName = ""; 1592 QString ownerName = "";
1592 KABC::AddressBook::Iterator iter; 1593 KABC::AddressBook::Iterator iter;
1593 KABC::PhoneNumber::List::Iterator phoneIter; 1594 KABC::PhoneNumber::List::Iterator phoneIter;
1594 KABC::PhoneNumber::List phoneList; 1595 KABC::PhoneNumber::List phoneList;
1595 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1596 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1596 phoneList = (*iter).phoneNumbers(); 1597 phoneList = (*iter).phoneNumbers();
1597 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1598 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1598 ++phoneIter) { 1599 ++phoneIter) {
1599 // Get rid of separator chars so just the numbers are compared. 1600 // Get rid of separator chars so just the numbers are compared.
1600 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1601 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1601 ownerName = (*iter).formattedName(); 1602 ownerName = (*iter).formattedName();
1602 found = true; 1603 found = true;
1603 } 1604 }
1604 } 1605 }
1605 } 1606 }
1606 1607
1607 return ownerName; 1608 return ownerName;
1608#else //KAB_EMBEDDED 1609#else //KAB_EMBEDDED
1609 qDebug("KABCore::getNameByPhone finsih method"); 1610 qDebug("KABCore::getNameByPhone finsih method");
1610 return ""; 1611 return "";
1611#endif //KAB_EMBEDDED 1612#endif //KAB_EMBEDDED
1612 1613
1613} 1614}
1614 1615void KABCore::openConfigGlobalDialog()
1616{
1617 KPimPrefsGlobalDialog gc ( this );
1618 gc.exec();
1619}
1615void KABCore::openConfigDialog() 1620void KABCore::openConfigDialog()
1616{ 1621{
1617 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1622 KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true);
1618 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1619 ConfigureDialog->addModule(kabcfg );
1620 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1621 ConfigureDialog->addModule(kdelibcfg );
1622 1623
1624 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" );
1625 ConfigureDialog->setMainWidget( kabcfg );
1623 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1626 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1624 this, SLOT( configurationChanged() ) ); 1627 this, SLOT( configurationChanged() ) );
1628 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1629 kabcfg, SLOT( save() ) );
1625 connect( ConfigureDialog, SIGNAL( okClicked() ), 1630 connect( ConfigureDialog, SIGNAL( okClicked() ),
1626 this, SLOT( configurationChanged() ) ); 1631 this, SLOT( configurationChanged() ) );
1632 connect( ConfigureDialog, SIGNAL( okClicked() ),
1633 kabcfg, SLOT( save() ) );
1634 connect( ConfigureDialog, SIGNAL( defaultClicked() ),
1635 kabcfg, SLOT( defaults() ) );
1627 saveSettings(); 1636 saveSettings();
1637 kabcfg->load();
1628#ifndef DESKTOP_VERSION 1638#ifndef DESKTOP_VERSION
1639 if ( QApplication::desktop()->height() <= 480 )
1640 ConfigureDialog->hideButtons();
1629 ConfigureDialog->showMaximized(); 1641 ConfigureDialog->showMaximized();
1630#endif 1642#endif
1631 if ( ConfigureDialog->exec() ) 1643 if ( ConfigureDialog->exec() )
1632 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1644 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1633 delete ConfigureDialog; 1645 delete ConfigureDialog;
1634} 1646}
1635 1647
1636void KABCore::openLDAPDialog() 1648void KABCore::openLDAPDialog()
1637{ 1649{
1638#ifndef KAB_EMBEDDED 1650#ifndef KAB_EMBEDDED
1639 if ( !mLdapSearchDialog ) { 1651 if ( !mLdapSearchDialog ) {
1640 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1652 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1641 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1653 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1642 SLOT( refreshView() ) ); 1654 SLOT( refreshView() ) );
1643 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1655 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1644 SLOT( setModified() ) ); 1656 SLOT( setModified() ) );
1645 } else 1657 } else
1646 mLdapSearchDialog->restoreSettings(); 1658 mLdapSearchDialog->restoreSettings();
1647 1659
1648 if ( mLdapSearchDialog->isOK() ) 1660 if ( mLdapSearchDialog->isOK() )
1649 mLdapSearchDialog->exec(); 1661 mLdapSearchDialog->exec();
1650#else //KAB_EMBEDDED 1662#else //KAB_EMBEDDED
1651 qDebug("KABCore::openLDAPDialog() finsih method"); 1663 qDebug("KABCore::openLDAPDialog() finsih method");
1652#endif //KAB_EMBEDDED 1664#endif //KAB_EMBEDDED
1653} 1665}
1654 1666
1655void KABCore::print() 1667void KABCore::print()
1656{ 1668{
1657#ifndef KAB_EMBEDDED 1669#ifndef KAB_EMBEDDED
1658 KPrinter printer; 1670 KPrinter printer;
1659 if ( !printer.setup( this ) ) 1671 if ( !printer.setup( this ) )
1660 return; 1672 return;
1661 1673
1662 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1674 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1663 mViewManager->selectedUids(), this ); 1675 mViewManager->selectedUids(), this );
1664 1676
1665 wizard.exec(); 1677 wizard.exec();
1666#else //KAB_EMBEDDED 1678#else //KAB_EMBEDDED
1667 qDebug("KABCore::print() finsih method"); 1679 qDebug("KABCore::print() finsih method");
1668#endif //KAB_EMBEDDED 1680#endif //KAB_EMBEDDED
1669 1681
1670} 1682}
1671 1683
1672 1684
1673void KABCore::addGUIClient( KXMLGUIClient *client ) 1685void KABCore::addGUIClient( KXMLGUIClient *client )
1674{ 1686{
1675 if ( mGUIClient ) 1687 if ( mGUIClient )
1676 mGUIClient->insertChildClient( client ); 1688 mGUIClient->insertChildClient( client );
1677 else 1689 else
1678 KMessageBox::error( this, "no KXMLGUICLient"); 1690 KMessageBox::error( this, "no KXMLGUICLient");
1679} 1691}
1680 1692
1681 1693
1682void KABCore::configurationChanged() 1694void KABCore::configurationChanged()
1683{ 1695{
1684 mExtensionManager->reconfigure(); 1696 mExtensionManager->reconfigure();
1685} 1697}
1686 1698
1687void KABCore::addressBookChanged() 1699void KABCore::addressBookChanged()
1688{ 1700{
1689/*US 1701/*US
1690 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1702 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1691 while ( it.current() ) { 1703 while ( it.current() ) {
1692 if ( it.current()->dirty() ) { 1704 if ( it.current()->dirty() ) {
1693 QString text = i18n( "Data has been changed externally. Unsaved " 1705 QString text = i18n( "Data has been changed externally. Unsaved "
1694 "changes will be lost." ); 1706 "changes will be lost." );
1695 KMessageBox::information( this, text ); 1707 KMessageBox::information( this, text );
1696 } 1708 }
1697 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1709 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1698 ++it; 1710 ++it;
1699 } 1711 }
1700*/ 1712*/
1701 if (mEditorDialog) 1713 if (mEditorDialog)
1702 { 1714 {
1703 if (mEditorDialog->dirty()) 1715 if (mEditorDialog->dirty())
1704 { 1716 {
1705 QString text = i18n( "Data has been changed externally. Unsaved " 1717 QString text = i18n( "Data has been changed externally. Unsaved "
1706 "changes will be lost." ); 1718 "changes will be lost." );
1707 KMessageBox::information( this, text ); 1719 KMessageBox::information( this, text );
1708 } 1720 }
1709 QString currentuid = mEditorDialog->addressee().uid(); 1721 QString currentuid = mEditorDialog->addressee().uid();
1710 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1722 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1711 } 1723 }
1712 mViewManager->refreshView(); 1724 mViewManager->refreshView();
1713 1725
1714 1726
1715} 1727}
1716 1728
1717AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1729AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1718 const char *name ) 1730 const char *name )
1719{ 1731{
1720 1732
1721 if ( mEditorDialog == 0 ) { 1733 if ( mEditorDialog == 0 ) {
1722 mEditorDialog = new AddresseeEditorDialog( this, parent, 1734 mEditorDialog = new AddresseeEditorDialog( this, parent,
1723 name ? name : "editorDialog" ); 1735 name ? name : "editorDialog" );
1724 1736
@@ -1932,198 +1944,199 @@ void KABCore::initActions()
1932 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1944 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1933 1945
1934 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1946 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1935 this, SLOT( mailVCard() ), 1947 this, SLOT( mailVCard() ),
1936 actionCollection(), "file_mail_vcard"); 1948 actionCollection(), "file_mail_vcard");
1937 1949
1938 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1950 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1939 SLOT( export2phone() ), actionCollection(), 1951 SLOT( export2phone() ), actionCollection(),
1940 "kaddressbook_ex2phone" ); 1952 "kaddressbook_ex2phone" );
1941 1953
1942 mActionBeamVCard = 0; 1954 mActionBeamVCard = 0;
1943 mActionBeam = 0; 1955 mActionBeam = 0;
1944 1956
1945#ifndef DESKTOP_VERSION 1957#ifndef DESKTOP_VERSION
1946 if ( Ir::supported() ) { 1958 if ( Ir::supported() ) {
1947 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1959 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1948 SLOT( beamVCard() ), actionCollection(), 1960 SLOT( beamVCard() ), actionCollection(),
1949 "kaddressbook_beam_vcard" ); 1961 "kaddressbook_beam_vcard" );
1950 1962
1951 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1963 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1952 SLOT( beamMySelf() ), actionCollection(), 1964 SLOT( beamMySelf() ), actionCollection(),
1953 "kaddressbook_beam_myself" ); 1965 "kaddressbook_beam_myself" );
1954 } 1966 }
1955#endif 1967#endif
1956 1968
1957 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1969 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1958 this, SLOT( editContact2() ), 1970 this, SLOT( editContact2() ),
1959 actionCollection(), "file_properties" ); 1971 actionCollection(), "file_properties" );
1960 1972
1961#ifdef KAB_EMBEDDED 1973#ifdef KAB_EMBEDDED
1962 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1974 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1963 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1975 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1964 mMainWindow, SLOT( exit() ), 1976 mMainWindow, SLOT( exit() ),
1965 actionCollection(), "quit" ); 1977 actionCollection(), "quit" );
1966#endif //KAB_EMBEDDED 1978#endif //KAB_EMBEDDED
1967 1979
1968 // edit menu 1980 // edit menu
1969 if ( mIsPart ) { 1981 if ( mIsPart ) {
1970 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1982 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1971 SLOT( copyContacts() ), actionCollection(), 1983 SLOT( copyContacts() ), actionCollection(),
1972 "kaddressbook_copy" ); 1984 "kaddressbook_copy" );
1973 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1985 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1974 SLOT( cutContacts() ), actionCollection(), 1986 SLOT( cutContacts() ), actionCollection(),
1975 "kaddressbook_cut" ); 1987 "kaddressbook_cut" );
1976 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1988 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1977 SLOT( pasteContacts() ), actionCollection(), 1989 SLOT( pasteContacts() ), actionCollection(),
1978 "kaddressbook_paste" ); 1990 "kaddressbook_paste" );
1979 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1991 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1980 SLOT( selectAllContacts() ), actionCollection(), 1992 SLOT( selectAllContacts() ), actionCollection(),
1981 "kaddressbook_select_all" ); 1993 "kaddressbook_select_all" );
1982 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1994 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1983 SLOT( undo() ), actionCollection(), 1995 SLOT( undo() ), actionCollection(),
1984 "kaddressbook_undo" ); 1996 "kaddressbook_undo" );
1985 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1997 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1986 this, SLOT( redo() ), actionCollection(), 1998 this, SLOT( redo() ), actionCollection(),
1987 "kaddressbook_redo" ); 1999 "kaddressbook_redo" );
1988 } else { 2000 } else {
1989 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 2001 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1990 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 2002 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1991 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 2003 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1992 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 2004 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1993 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 2005 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1994 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 2006 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1995 } 2007 }
1996 2008
1997 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 2009 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1998 Key_Delete, this, SLOT( deleteContacts() ), 2010 Key_Delete, this, SLOT( deleteContacts() ),
1999 actionCollection(), "edit_delete" ); 2011 actionCollection(), "edit_delete" );
2000 2012
2001 mActionUndo->setEnabled( false ); 2013 mActionUndo->setEnabled( false );
2002 mActionRedo->setEnabled( false ); 2014 mActionRedo->setEnabled( false );
2003 2015
2004 // settings menu 2016 // settings menu
2005#ifdef KAB_EMBEDDED 2017#ifdef KAB_EMBEDDED
2006//US special menuentry to configure the addressbook resources. On KDE 2018//US special menuentry to configure the addressbook resources. On KDE
2007// you do that through the control center !!! 2019// you do that through the control center !!!
2008 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 2020 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
2009 SLOT( configureResources() ), actionCollection(), 2021 SLOT( configureResources() ), actionCollection(),
2010 "kaddressbook_configure_resources" ); 2022 "kaddressbook_configure_resources" );
2011#endif //KAB_EMBEDDED 2023#endif //KAB_EMBEDDED
2012 2024
2013 if ( mIsPart ) { 2025 if ( mIsPart ) {
2014 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 2026 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
2015 SLOT( openConfigDialog() ), actionCollection(), 2027 SLOT( openConfigDialog() ), actionCollection(),
2016 "kaddressbook_configure" ); 2028 "kaddressbook_configure" );
2017 2029
2018 //US not implemented yet 2030 //US not implemented yet
2019 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 2031 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
2020 // this, SLOT( configureKeyBindings() ), actionCollection(), 2032 // this, SLOT( configureKeyBindings() ), actionCollection(),
2021 // "kaddressbook_configure_shortcuts" ); 2033 // "kaddressbook_configure_shortcuts" );
2022#ifdef KAB_EMBEDDED 2034#ifdef KAB_EMBEDDED
2023 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 2035 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
2024 mActionConfigureToolbars->setEnabled( false ); 2036 mActionConfigureToolbars->setEnabled( false );
2025#endif //KAB_EMBEDDED 2037#endif //KAB_EMBEDDED
2026 2038
2027 } else { 2039 } else {
2028 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 2040 mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this,
2029 2041 SLOT( openConfigDialog() ), actionCollection(),
2030 //US not implemented yet 2042 "kaddressbook_configure" );
2031 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 2043 mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this,
2044 SLOT( openConfigGlobalDialog() ), actionCollection(),
2045 "kaddressbook_configure" );
2032 } 2046 }
2033
2034 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 2047 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2035 actionCollection(), "options_show_jump_bar" ); 2048 actionCollection(), "options_show_jump_bar" );
2036 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); 2049 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
2037 2050
2038 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2051 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2039 actionCollection(), "options_show_details" ); 2052 actionCollection(), "options_show_details" );
2040 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2053 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2041 2054
2042 2055
2043 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2056 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2044 SLOT( toggleBeamReceive() ), actionCollection(), 2057 SLOT( toggleBeamReceive() ), actionCollection(),
2045 "kaddressbook_beam_rec" ); 2058 "kaddressbook_beam_rec" );
2046 2059
2047 2060
2048 // misc 2061 // misc
2049 // only enable LDAP lookup if we can handle the protocol 2062 // only enable LDAP lookup if we can handle the protocol
2050#ifndef KAB_EMBEDDED 2063#ifndef KAB_EMBEDDED
2051 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2064 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2052 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2065 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2053 this, SLOT( openLDAPDialog() ), actionCollection(), 2066 this, SLOT( openLDAPDialog() ), actionCollection(),
2054 "ldap_lookup" ); 2067 "ldap_lookup" );
2055 } 2068 }
2056#else //KAB_EMBEDDED 2069#else //KAB_EMBEDDED
2057 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2070 //qDebug("KABCore::initActions() LDAP has to be implemented");
2058#endif //KAB_EMBEDDED 2071#endif //KAB_EMBEDDED
2059 2072
2060 2073
2061 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2074 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2062 SLOT( setWhoAmI() ), actionCollection(), 2075 SLOT( setWhoAmI() ), actionCollection(),
2063 "set_personal" ); 2076 "set_personal" );
2064 2077
2065 2078
2066 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, 2079 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this,
2067 SLOT( setCategories() ), actionCollection(), 2080 SLOT( setCategories() ), actionCollection(),
2068 "edit_set_categories" ); 2081 "edit_set_categories" );
2069 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, 2082 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
2070 SLOT( editCategories() ), actionCollection(), 2083 SLOT( editCategories() ), actionCollection(),
2071 "edit__categories" ); 2084 "edit__categories" );
2072 2085
2073 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2086 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2074 SLOT( removeVoice() ), actionCollection(), 2087 SLOT( removeVoice() ), actionCollection(),
2075 "remove_voice" ); 2088 "remove_voice" );
2076 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2089 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2077 SLOT( setFormattedName() ), actionCollection(), 2090 SLOT( setFormattedName() ), actionCollection(),
2078 "set_formatted" ); 2091 "set_formatted" );
2079 2092
2080 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2093 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2081 SLOT( manageCategories() ), actionCollection(), 2094 SLOT( manageCategories() ), actionCollection(),
2082 "remove_voice" ); 2095 "remove_voice" );
2083 2096
2084 2097
2085 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2098 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2086 SLOT( importFromOL() ), actionCollection(), 2099 SLOT( importFromOL() ), actionCollection(),
2087 "import_OL" ); 2100 "import_OL" );
2088#ifdef KAB_EMBEDDED 2101#ifdef KAB_EMBEDDED
2089 mActionLicence = new KAction( i18n( "Licence" ), 0, 2102 mActionLicence = new KAction( i18n( "Licence" ), 0,
2090 this, SLOT( showLicence() ), actionCollection(), 2103 this, SLOT( showLicence() ), actionCollection(),
2091 "licence_about_data" ); 2104 "licence_about_data" );
2092 mActionFaq = new KAction( i18n( "Faq" ), 0, 2105 mActionFaq = new KAction( i18n( "Faq" ), 0,
2093 this, SLOT( faq() ), actionCollection(), 2106 this, SLOT( faq() ), actionCollection(),
2094 "faq_about_data" ); 2107 "faq_about_data" );
2095 mActionWN = new KAction( i18n( "What's New?" ), 0, 2108 mActionWN = new KAction( i18n( "What's New?" ), 0,
2096 this, SLOT( whatsnew() ), actionCollection(), 2109 this, SLOT( whatsnew() ), actionCollection(),
2097 "wn" ); 2110 "wn" );
2098 2111
2099 2112
2100 2113
2101 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, 2114 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0,
2102 this, SLOT( storagehowto() ), actionCollection(), 2115 this, SLOT( storagehowto() ), actionCollection(),
2103 "storage" ); 2116 "storage" );
2104 2117
2105 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2118 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2106 this, SLOT( synchowto() ), actionCollection(), 2119 this, SLOT( synchowto() ), actionCollection(),
2107 "sync" ); 2120 "sync" );
2108 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2121 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2109 this, SLOT( kdesynchowto() ), actionCollection(), 2122 this, SLOT( kdesynchowto() ), actionCollection(),
2110 "kdesync" ); 2123 "kdesync" );
2111 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2124 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2112 this, SLOT( multisynchowto() ), actionCollection(), 2125 this, SLOT( multisynchowto() ), actionCollection(),
2113 "multisync" ); 2126 "multisync" );
2114 2127
2115 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2128 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2116 this, SLOT( createAboutData() ), actionCollection(), 2129 this, SLOT( createAboutData() ), actionCollection(),
2117 "kaddressbook_about_data" ); 2130 "kaddressbook_about_data" );
2118#endif //KAB_EMBEDDED 2131#endif //KAB_EMBEDDED
2119 2132
2120 clipboardDataChanged(); 2133 clipboardDataChanged();
2121 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2134 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2122 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2135 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2123} 2136}
2124 2137
2125//US we need this function, to plug all actions into the correct menues. 2138//US we need this function, to plug all actions into the correct menues.
2126// KDE uses a XML format to plug the actions, but we work her without this overhead. 2139// KDE uses a XML format to plug the actions, but we work her without this overhead.
2127void KABCore::addActionsManually() 2140void KABCore::addActionsManually()
2128{ 2141{
2129//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2142//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
@@ -2150,194 +2163,195 @@ void KABCore::addActionsManually()
2150 mb->insertItem( i18n("Synchronize"), syncMenu ); 2163 mb->insertItem( i18n("Synchronize"), syncMenu );
2151#else 2164#else
2152 mb->insertItem( i18n("Sync"), syncMenu ); 2165 mb->insertItem( i18n("Sync"), syncMenu );
2153#endif 2166#endif
2154 //mb->insertItem( i18n("&Change"), changeMenu ); 2167 //mb->insertItem( i18n("&Change"), changeMenu );
2155 mb->insertItem( i18n("&Help"), helpMenu ); 2168 mb->insertItem( i18n("&Help"), helpMenu );
2156 mIncSearchWidget = new IncSearchWidget( tb ); 2169 mIncSearchWidget = new IncSearchWidget( tb );
2157 // tb->insertWidget(-1, 0, mIncSearchWidget); 2170 // tb->insertWidget(-1, 0, mIncSearchWidget);
2158#ifndef DESKTOP_VERSION 2171#ifndef DESKTOP_VERSION
2159 } else { 2172 } else {
2160 //US setup toolbar 2173 //US setup toolbar
2161 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2174 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2162 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2175 QPopupMenu *popupBarTB = new QPopupMenu( this );
2163 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2176 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2164 tb->insertWidget(-1, 0, menuBarTB); 2177 tb->insertWidget(-1, 0, menuBarTB);
2165 mIncSearchWidget = new IncSearchWidget( tb ); 2178 mIncSearchWidget = new IncSearchWidget( tb );
2166 tb->enableMoving(false); 2179 tb->enableMoving(false);
2167 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2180 popupBarTB->insertItem( i18n("&File"), fileMenu );
2168 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2181 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2169 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2182 popupBarTB->insertItem( i18n("&View"), viewMenu );
2170 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2183 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2171 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2184 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2172 mViewManager->getFilterAction()->plug ( popupBarTB); 2185 mViewManager->getFilterAction()->plug ( popupBarTB);
2173 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2186 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2174 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2187 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2175 if (QApplication::desktop()->width() > 320 ) { 2188 if (QApplication::desktop()->width() > 320 ) {
2176 // mViewManager->getFilterAction()->plug ( tb); 2189 // mViewManager->getFilterAction()->plug ( tb);
2177 } 2190 }
2178 } 2191 }
2179#endif 2192#endif
2180 mIncSearchWidget->setSize(); 2193 mIncSearchWidget->setSize();
2181 // mActionQuit->plug ( mMainWindow->toolBar()); 2194 // mActionQuit->plug ( mMainWindow->toolBar());
2182 2195
2183 2196
2184 2197
2185 //US Now connect the actions with the menue entries. 2198 //US Now connect the actions with the menue entries.
2186#ifdef DESKTOP_VERSION 2199#ifdef DESKTOP_VERSION
2187 mActionPrint->plug( fileMenu ); 2200 mActionPrint->plug( fileMenu );
2188 mActionPrintDetails->plug( fileMenu ); 2201 mActionPrintDetails->plug( fileMenu );
2189 fileMenu->insertSeparator(); 2202 fileMenu->insertSeparator();
2190#endif 2203#endif
2191 mActionMail->plug( fileMenu ); 2204 mActionMail->plug( fileMenu );
2192 fileMenu->insertSeparator(); 2205 fileMenu->insertSeparator();
2193 2206
2194 mActionNewContact->plug( editMenu ); 2207 mActionNewContact->plug( editMenu );
2195 mActionNewContact->plug( tb ); 2208 mActionNewContact->plug( tb );
2196 2209
2197 mActionEditAddressee->plug( editMenu ); 2210 mActionEditAddressee->plug( editMenu );
2198 editMenu->insertSeparator(); 2211 editMenu->insertSeparator();
2199 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2212 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2200 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2213 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2201 mActionEditAddressee->plug( tb ); 2214 mActionEditAddressee->plug( tb );
2202 2215
2203 // fileMenu->insertSeparator(); 2216 // fileMenu->insertSeparator();
2204 mActionSave->plug( fileMenu ); 2217 mActionSave->plug( fileMenu );
2205 fileMenu->insertItem( "&Import", ImportMenu ); 2218 fileMenu->insertItem( "&Import", ImportMenu );
2206 fileMenu->insertItem( "&Export", ExportMenu ); 2219 fileMenu->insertItem( "&Export", ExportMenu );
2207 editMenu->insertItem( i18n("&Change"), changeMenu ); 2220 editMenu->insertItem( i18n("&Change"), changeMenu );
2208 editMenu->insertSeparator(); 2221 editMenu->insertSeparator();
2209#ifndef DESKTOP_VERSION 2222#ifndef DESKTOP_VERSION
2210 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2223 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2211#endif 2224#endif
2212#if 0 2225#if 0
2213 // PENDING fix MailVCard 2226 // PENDING fix MailVCard
2214 fileMenu->insertSeparator(); 2227 fileMenu->insertSeparator();
2215 mActionMailVCard->plug( fileMenu ); 2228 mActionMailVCard->plug( fileMenu );
2216#endif 2229#endif
2217#ifndef DESKTOP_VERSION 2230#ifndef DESKTOP_VERSION
2218 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2231 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2219 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2232 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2220 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2233 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2221#endif 2234#endif
2222 fileMenu->insertSeparator(); 2235 fileMenu->insertSeparator();
2223 mActionQuit->plug( fileMenu ); 2236 mActionQuit->plug( fileMenu );
2224#ifdef _OL_IMPORT_ 2237#ifdef _OL_IMPORT_
2225 mActionImportOL->plug( ImportMenu ); 2238 mActionImportOL->plug( ImportMenu );
2226#endif 2239#endif
2227 // edit menu 2240 // edit menu
2228 mActionUndo->plug( editMenu ); 2241 mActionUndo->plug( editMenu );
2229 mActionRedo->plug( editMenu ); 2242 mActionRedo->plug( editMenu );
2230 editMenu->insertSeparator(); 2243 editMenu->insertSeparator();
2231 mActionCut->plug( editMenu ); 2244 mActionCut->plug( editMenu );
2232 mActionCopy->plug( editMenu ); 2245 mActionCopy->plug( editMenu );
2233 mActionPaste->plug( editMenu ); 2246 mActionPaste->plug( editMenu );
2234 mActionDelete->plug( editMenu ); 2247 mActionDelete->plug( editMenu );
2235 editMenu->insertSeparator(); 2248 editMenu->insertSeparator();
2236 mActionSelectAll->plug( editMenu ); 2249 mActionSelectAll->plug( editMenu );
2237 2250
2238 mActionSetFormattedName->plug( changeMenu ); 2251 mActionSetFormattedName->plug( changeMenu );
2239 mActionRemoveVoice->plug( changeMenu ); 2252 mActionRemoveVoice->plug( changeMenu );
2240 // settingsmings menu 2253 // settingsmings menu
2241//US special menuentry to configure the addressbook resources. On KDE 2254//US special menuentry to configure the addressbook resources. On KDE
2242// you do that through the control center !!! 2255// you do that through the control center !!!
2243 // settingsMenu->insertSeparator(); 2256 // settingsMenu->insertSeparator();
2244 2257
2245 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2258 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2246 mActionConfigResources->plug( settingsMenu,1 ); 2259 mActionConfigGlobal->plug( settingsMenu, 1 );
2247 settingsMenu->insertSeparator(2); 2260 mActionConfigResources->plug( settingsMenu,2 );
2261 settingsMenu->insertSeparator(3);
2248 2262
2249 if ( mIsPart ) { 2263 if ( mIsPart ) {
2250 //US not implemented yet 2264 //US not implemented yet
2251 //mActionConfigShortcuts->plug( settingsMenu ); 2265 //mActionConfigShortcuts->plug( settingsMenu );
2252 //mActionConfigureToolbars->plug( settingsMenu ); 2266 //mActionConfigureToolbars->plug( settingsMenu );
2253 2267
2254 } else { 2268 } else {
2255 //US not implemented yet 2269 //US not implemented yet
2256 //mActionKeyBindings->plug( settingsMenu ); 2270 //mActionKeyBindings->plug( settingsMenu );
2257 } 2271 }
2258 2272
2259 mActionEditCategories->plug( settingsMenu ); 2273 mActionEditCategories->plug( settingsMenu );
2260 mActionManageCategories->plug( settingsMenu ); 2274 mActionManageCategories->plug( settingsMenu );
2261 mActionJumpBar->plug( viewMenu,0 ); 2275 mActionJumpBar->plug( viewMenu,0 );
2262 mActionDetails->plug( viewMenu,0 ); 2276 mActionDetails->plug( viewMenu,0 );
2263 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2277 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2264 mActionDetails->plug( tb ); 2278 mActionDetails->plug( tb );
2265 settingsMenu->insertSeparator(); 2279 settingsMenu->insertSeparator();
2266#ifndef DESKTOP_VERSION 2280#ifndef DESKTOP_VERSION
2267 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2281 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2268 settingsMenu->insertSeparator(); 2282 settingsMenu->insertSeparator();
2269#endif 2283#endif
2270 2284
2271 mActionWhoAmI->plug( settingsMenu ); 2285 mActionWhoAmI->plug( settingsMenu );
2272 //mActionEditCategories->plug( changeMenu ); 2286 //mActionEditCategories->plug( changeMenu );
2273 mActionCategories->plug( changeMenu ); 2287 mActionCategories->plug( changeMenu );
2274 //mActionManageCategories->plug( changeMenu ); 2288 //mActionManageCategories->plug( changeMenu );
2275 2289
2276 //mActionCategories->plug( settingsMenu ); 2290 //mActionCategories->plug( settingsMenu );
2277 2291
2278 2292
2279 mActionWN->plug( helpMenu ); 2293 mActionWN->plug( helpMenu );
2280 mActionStorageHowto->plug( helpMenu ); 2294 mActionStorageHowto->plug( helpMenu );
2281 mActionSyncHowto->plug( helpMenu ); 2295 mActionSyncHowto->plug( helpMenu );
2282 mActionKdeSyncHowto->plug( helpMenu ); 2296 mActionKdeSyncHowto->plug( helpMenu );
2283 mActionMultiSyncHowto->plug( helpMenu ); 2297 mActionMultiSyncHowto->plug( helpMenu );
2284 mActionFaq->plug( helpMenu ); 2298 mActionFaq->plug( helpMenu );
2285 mActionLicence->plug( helpMenu ); 2299 mActionLicence->plug( helpMenu );
2286 mActionAboutKAddressbook->plug( helpMenu ); 2300 mActionAboutKAddressbook->plug( helpMenu );
2287 2301
2288 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2302 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2289 2303
2290 mActionSave->plug( tb ); 2304 mActionSave->plug( tb );
2291 mViewManager->getFilterAction()->plug ( tb); 2305 mViewManager->getFilterAction()->plug ( tb);
2292 //LR hide filteraction on started in 480x640 2306 //LR hide filteraction on started in 480x640
2293 if (QApplication::desktop()->width() == 480 ) { 2307 if (QApplication::desktop()->width() == 480 ) {
2294 mViewManager->getFilterAction()->setComboWidth( 0 ); 2308 mViewManager->getFilterAction()->setComboWidth( 0 );
2295 } 2309 }
2296 mActionUndo->plug( tb ); 2310 mActionUndo->plug( tb );
2297 mActionDelete->plug( tb ); 2311 mActionDelete->plug( tb );
2298 mActionRedo->plug( tb ); 2312 mActionRedo->plug( tb );
2299 } else { 2313 } else {
2300 mActionSave->plug( tb ); 2314 mActionSave->plug( tb );
2301 tb->enableMoving(false); 2315 tb->enableMoving(false);
2302 } 2316 }
2303 //mActionQuit->plug ( tb ); 2317 //mActionQuit->plug ( tb );
2304 //tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2318 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2305 2319
2306 //US link the searchwidget first to this. 2320 //US link the searchwidget first to this.
2307 // The real linkage to the toolbar happens later. 2321 // The real linkage to the toolbar happens later.
2308//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2322//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2309//US tb->insertItem( mIncSearchWidget ); 2323//US tb->insertItem( mIncSearchWidget );
2310/*US 2324/*US
2311 mIncSearchWidget = new IncSearchWidget( tb ); 2325 mIncSearchWidget = new IncSearchWidget( tb );
2312 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2326 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2313 SLOT( incrementalSearch( const QString& ) ) ); 2327 SLOT( incrementalSearch( const QString& ) ) );
2314 2328
2315 mJumpButtonBar = new JumpButtonBar( this, this ); 2329 mJumpButtonBar = new JumpButtonBar( this, this );
2316 2330
2317//US topLayout->addWidget( mJumpButtonBar ); 2331//US topLayout->addWidget( mJumpButtonBar );
2318 this->layout()->add( mJumpButtonBar ); 2332 this->layout()->add( mJumpButtonBar );
2319*/ 2333*/
2320 2334
2321#endif //KAB_EMBEDDED 2335#endif //KAB_EMBEDDED
2322 2336
2323 mActionExport2phone->plug( ExportMenu ); 2337 mActionExport2phone->plug( ExportMenu );
2324 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2338 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2325 syncManager->fillSyncMenu(); 2339 syncManager->fillSyncMenu();
2326 2340
2327} 2341}
2328void KABCore::showLicence() 2342void KABCore::showLicence()
2329{ 2343{
2330 KApplication::showLicence(); 2344 KApplication::showLicence();
2331} 2345}
2332 2346
2333void KABCore::manageCategories( ) 2347void KABCore::manageCategories( )
2334{ 2348{
2335 KABCatPrefs* cp = new KABCatPrefs(); 2349 KABCatPrefs* cp = new KABCatPrefs();
2336 cp->show(); 2350 cp->show();
2337 int w =cp->sizeHint().width() ; 2351 int w =cp->sizeHint().width() ;
2338 int h = cp->sizeHint().height() ; 2352 int h = cp->sizeHint().height() ;
2339 int dw = QApplication::desktop()->width(); 2353 int dw = QApplication::desktop()->width();
2340 int dh = QApplication::desktop()->height(); 2354 int dh = QApplication::desktop()->height();
2341 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2355 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2342 if ( !cp->exec() ) { 2356 if ( !cp->exec() ) {
2343 delete cp; 2357 delete cp;