summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorulf69 <ulf69>2004-07-15 05:06:06 (UTC)
committer ulf69 <ulf69>2004-07-15 05:06:06 (UTC)
commit59f727076930aada485db6531d4084f2bfe0b928 (patch) (unidiff)
treed68ab61d9f78759d36d8ccb2cdd3312987bf7917 /kaddressbook
parent2ada2bfd67b5488115268e6667e55a9b4b297fa2 (diff)
downloadkdepimpi-59f727076930aada485db6531d4084f2bfe0b928.zip
kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.tar.gz
kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.tar.bz2
ask for readwrite resources if the user wants them to reload in the case of an
external change.
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp3
-rw-r--r--kaddressbook/kabcore.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index 8f566cf..a42499f 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -1,171 +1,172 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> 3 Copyright (c) 1996-2002 Mirko Boehm <mirko@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 As a special exception, permission is given to link this program 19 As 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#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29 29
30#include <kapplication.h> 30#include <kapplication.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kdialog.h> 32#include <kdialog.h>
33 33
34#include "look_basic.h" 34#include "look_basic.h"
35//#include "look_details.h" 35//#include "look_details.h"
36#include "look_html.h" 36#include "look_html.h"
37 37
38#ifdef KAB_EMBEDDED 38#ifdef KAB_EMBEDDED
39#include "kabprefs.h" 39#include "kabprefs.h"
40#endif //KAB_EMBEDDED 40#endif //KAB_EMBEDDED
41 41
42 42
43#include "detailsviewcontainer.h" 43#include "detailsviewcontainer.h"
44 44
45ViewContainer::ViewContainer( QWidget *parent, const char* name ) 45ViewContainer::ViewContainer( QWidget *parent, const char* name )
46 : QWidget( parent, name ), mCurrentLook( 0 ) 46 : QWidget( parent, name ), mCurrentLook( 0 )
47{ 47{
48 QBoxLayout *topLayout = new QVBoxLayout( this ); 48 QBoxLayout *topLayout = new QVBoxLayout( this );
49 //topLayout->setMargin( KDialog::marginHint() ); 49 //topLayout->setMargin( KDialog::marginHint() );
50 //topLayout->setSpacing( KDialog::spacingHint() ); 50 //topLayout->setSpacing( KDialog::spacingHint() );
51 topLayout->setMargin( 0 ); 51 topLayout->setMargin( 0 );
52 topLayout->setSpacing( 0 ); 52 topLayout->setSpacing( 0 );
53 53
54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); 54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
55 55
56 QLabel *label = new QLabel( i18n("Style:"), this ); 56 QLabel *label = new QLabel( i18n("Style:"), this );
57 styleLayout->addWidget( label ); 57 styleLayout->addWidget( label );
58 58
59 mStyleCombo = new QComboBox( this ); 59 mStyleCombo = new QComboBox( this );
60 styleLayout->addWidget( mStyleCombo ); 60 styleLayout->addWidget( mStyleCombo );
61 61
62 QFrame *frameRuler = new QFrame( this ); 62 QFrame *frameRuler = new QFrame( this );
63//US frameRuler->setFrameShape( QFrame::HLine ); 63//US frameRuler->setFrameShape( QFrame::HLine );
64//US frameRuler->setFrameShadow( QFrame::Sunken ); 64//US frameRuler->setFrameShadow( QFrame::Sunken );
65//US topLayout->addWidget( frameRuler ); 65//US topLayout->addWidget( frameRuler );
66 66
67 mDetailsStack = new QWidgetStack( this ); 67 mDetailsStack = new QWidgetStack( this );
68 topLayout->addWidget( mDetailsStack, 1 ); 68 topLayout->addWidget( mDetailsStack, 1 );
69 69
70 registerLooks(); 70 registerLooks();
71 71
72#if 1 72#if 1
73 // Hide detailed view selection combo box, because we currently have 73 // Hide detailed view selection combo box, because we currently have
74 // only one. Reenable it when there are more detailed views. 74 // only one. Reenable it when there are more detailed views.
75 label->hide(); 75 label->hide();
76 mStyleCombo->hide(); 76 mStyleCombo->hide();
77 frameRuler->hide(); 77 frameRuler->hide();
78#endif 78#endif
79} 79}
80 80
81KABBasicLook *ViewContainer::currentLook() 81KABBasicLook *ViewContainer::currentLook()
82{ 82{
83 return mCurrentLook; 83 return mCurrentLook;
84} 84}
85 85
86void ViewContainer::registerLooks() 86void ViewContainer::registerLooks()
87{ 87{
88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); 88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); 89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
90 mStyleCombo->clear(); 90 mStyleCombo->clear();
91 91
92 for ( uint i = 0; i < mLookFactories.count(); ++i ) 92 for ( uint i = 0; i < mLookFactories.count(); ++i )
93 mStyleCombo->insertItem( mLookFactories.at( i )->description() ); 93 mStyleCombo->insertItem( mLookFactories.at( i )->description() );
94 94
95 if ( !mLookFactories.isEmpty() ) 95 if ( !mLookFactories.isEmpty() )
96 slotStyleSelected( 0 ); 96 slotStyleSelected( 0 );
97} 97}
98 98
99void ViewContainer::slotStyleSelected( int index ) 99void ViewContainer::slotStyleSelected( int index )
100{ 100{
101#ifndef KAB_EMBEDDED 101#ifndef KAB_EMBEDDED
102 KConfig *config = kapp->config(); 102 KConfig *config = kapp->config();
103#else //KAB_EMBEDDED 103#else //KAB_EMBEDDED
104 //US I hope I got the same config object as above expected. 104 //US I hope I got the same config object as above expected.
105 KConfig *config = KABPrefs::instance()->getConfig(); 105 KConfig *config = KABPrefs::instance()->getConfig();
106#endif //KAB_EMBEDDED 106#endif //KAB_EMBEDDED
107 KABC::Addressee addr; 107 KABC::Addressee addr;
108 108
109 if ( index >= 0 && index < mStyleCombo->count() ) { 109 if ( index >= 0 && index < mStyleCombo->count() ) {
110 if ( mCurrentLook != 0 ) { 110 if ( mCurrentLook != 0 ) {
111 mCurrentLook->saveSettings( config ); 111 mCurrentLook->saveSettings( config );
112 addr = mCurrentLook->addressee(); 112 addr = mCurrentLook->addressee();
113 113
114 delete mCurrentLook; 114 delete mCurrentLook;
115 mCurrentLook = 0; 115 mCurrentLook = 0;
116 } 116 }
117 117
118 KABLookFactory *factory = mLookFactories.at( index ); 118 KABLookFactory *factory = mLookFactories.at( index );
119 kdDebug(5720) << "ViewContainer::slotStyleSelected: " 119 kdDebug(5720) << "ViewContainer::slotStyleSelected: "
120 << "creating look " 120 << "creating look "
121 << factory->description() << endl; 121 << factory->description() << endl;
122 122
123 mCurrentLook = factory->create(); 123 mCurrentLook = factory->create();
124 mDetailsStack->raiseWidget( mCurrentLook ); 124 mDetailsStack->raiseWidget( mCurrentLook );
125 125
126 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, 126 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
127 SIGNAL( sendEmail( const QString& ) ) ); 127 SIGNAL( sendEmail( const QString& ) ) );
128 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, 128 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
129 SIGNAL( browse( const QString& ) ) ); 129 SIGNAL( browse( const QString& ) ) );
130 } 130 }
131 131
132 mCurrentLook->restoreSettings( config ); 132 mCurrentLook->restoreSettings( config );
133 mCurrentLook->setAddressee( addr ); 133 mCurrentLook->setAddressee( addr );
134} 134}
135void ViewContainer::refreshView() 135void ViewContainer::refreshView()
136{ 136{
137 if ( mCurrentLook ) 137 if ( mCurrentLook ) {
138 mCurrentLook->setAddressee( mCurrentAddressee ); 138 mCurrentLook->setAddressee( mCurrentAddressee );
139 }
139} 140}
140 141
141void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 142void ViewContainer::setAddressee( const KABC::Addressee& addressee )
142{ 143{
143 if ( mCurrentLook != 0 ) { 144 if ( mCurrentLook != 0 ) {
144 if ( addressee == mCurrentAddressee ) 145 if ( addressee == mCurrentAddressee )
145 return; 146 return;
146 else { 147 else {
147 mCurrentAddressee = addressee; 148 mCurrentAddressee = addressee;
148 mCurrentLook->setAddressee( mCurrentAddressee ); 149 mCurrentLook->setAddressee( mCurrentAddressee );
149 } 150 }
150 } 151 }
151} 152}
152 153
153KABC::Addressee ViewContainer::addressee() 154KABC::Addressee ViewContainer::addressee()
154{ 155{
155 static KABC::Addressee empty; // do not use! 156 static KABC::Addressee empty; // do not use!
156 157
157 if ( !mCurrentLook ) 158 if ( !mCurrentLook )
158 return empty; 159 return empty;
159 else 160 else
160 return mCurrentLook->addressee(); 161 return mCurrentLook->addressee();
161} 162}
162 163
163void ViewContainer::setReadOnly( bool state ) 164void ViewContainer::setReadOnly( bool state )
164{ 165{
165 if ( mCurrentLook ) 166 if ( mCurrentLook )
166 mCurrentLook->setReadOnly( state ); 167 mCurrentLook->setReadOnly( state );
167} 168}
168 169
169#ifndef KAB_EMBEDDED 170#ifndef KAB_EMBEDDED
170#include "detailsviewcontainer.moc" 171#include "detailsviewcontainer.moc"
171#endif //KAB_EMBEDDED 172#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2b07541..a7ca0ce 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -743,768 +743,769 @@ void KABCore::setModifiedWOrefresh()
743 743
744} 744}
745void KABCore::setModified( bool modified ) 745void KABCore::setModified( bool modified )
746{ 746{
747 mModified = modified; 747 mModified = modified;
748 mActionSave->setEnabled( mModified ); 748 mActionSave->setEnabled( mModified );
749 749
750 if ( modified ) 750 if ( modified )
751 mJumpButtonBar->recreateButtons(); 751 mJumpButtonBar->recreateButtons();
752 752
753 mViewManager->refreshView(); 753 mViewManager->refreshView();
754 mDetails->refreshView(); 754 mDetails->refreshView();
755 755
756} 756}
757 757
758bool KABCore::modified() const 758bool KABCore::modified() const
759{ 759{
760 return mModified; 760 return mModified;
761} 761}
762 762
763void KABCore::contactModified( const KABC::Addressee &addr ) 763void KABCore::contactModified( const KABC::Addressee &addr )
764{ 764{
765 765
766 Command *command = 0; 766 Command *command = 0;
767 QString uid; 767 QString uid;
768 768
769 // check if it exists already 769 // check if it exists already
770 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 770 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
771 if ( origAddr.isEmpty() ) 771 if ( origAddr.isEmpty() )
772 command = new PwNewCommand( mAddressBook, addr ); 772 command = new PwNewCommand( mAddressBook, addr );
773 else { 773 else {
774 command = new PwEditCommand( mAddressBook, origAddr, addr ); 774 command = new PwEditCommand( mAddressBook, origAddr, addr );
775 uid = addr.uid(); 775 uid = addr.uid();
776 } 776 }
777 777
778 UndoStack::instance()->push( command ); 778 UndoStack::instance()->push( command );
779 RedoStack::instance()->clear(); 779 RedoStack::instance()->clear();
780 780
781 setModified( true ); 781 setModified( true );
782} 782}
783 783
784void KABCore::newContact() 784void KABCore::newContact()
785{ 785{
786 786
787 787
788 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 788 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
789 789
790 QPtrList<KRES::Resource> kresResources; 790 QPtrList<KRES::Resource> kresResources;
791 QPtrListIterator<KABC::Resource> it( kabcResources ); 791 QPtrListIterator<KABC::Resource> it( kabcResources );
792 KABC::Resource *resource; 792 KABC::Resource *resource;
793 while ( ( resource = it.current() ) != 0 ) { 793 while ( ( resource = it.current() ) != 0 ) {
794 ++it; 794 ++it;
795 if ( !resource->readOnly() ) { 795 if ( !resource->readOnly() ) {
796 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 796 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
797 if ( res ) 797 if ( res )
798 kresResources.append( res ); 798 kresResources.append( res );
799 } 799 }
800 } 800 }
801 801
802 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 802 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
803 resource = static_cast<KABC::Resource*>( res ); 803 resource = static_cast<KABC::Resource*>( res );
804 804
805 if ( resource ) { 805 if ( resource ) {
806 KABC::Addressee addr; 806 KABC::Addressee addr;
807 addr.setResource( resource ); 807 addr.setResource( resource );
808 mEditorDialog->setAddressee( addr ); 808 mEditorDialog->setAddressee( addr );
809 KApplication::execDialog ( mEditorDialog ); 809 KApplication::execDialog ( mEditorDialog );
810 810
811 } else 811 } else
812 return; 812 return;
813 813
814 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 814 // mEditorDict.insert( dialog->addressee().uid(), dialog );
815 815
816 816
817} 817}
818 818
819void KABCore::addEmail( QString aStr ) 819void KABCore::addEmail( QString aStr )
820{ 820{
821#ifndef KAB_EMBEDDED 821#ifndef KAB_EMBEDDED
822 QString fullName, email; 822 QString fullName, email;
823 823
824 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 824 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
825 825
826 // Try to lookup the addressee matching the email address 826 // Try to lookup the addressee matching the email address
827 bool found = false; 827 bool found = false;
828 QStringList emailList; 828 QStringList emailList;
829 KABC::AddressBook::Iterator it; 829 KABC::AddressBook::Iterator it;
830 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 830 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
831 emailList = (*it).emails(); 831 emailList = (*it).emails();
832 if ( emailList.contains( email ) > 0 ) { 832 if ( emailList.contains( email ) > 0 ) {
833 found = true; 833 found = true;
834 (*it).setNameFromString( fullName ); 834 (*it).setNameFromString( fullName );
835 editContact( (*it).uid() ); 835 editContact( (*it).uid() );
836 } 836 }
837 } 837 }
838 838
839 if ( !found ) { 839 if ( !found ) {
840 KABC::Addressee addr; 840 KABC::Addressee addr;
841 addr.setNameFromString( fullName ); 841 addr.setNameFromString( fullName );
842 addr.insertEmail( email, true ); 842 addr.insertEmail( email, true );
843 843
844 mAddressBook->insertAddressee( addr ); 844 mAddressBook->insertAddressee( addr );
845 mViewManager->refreshView( addr.uid() ); 845 mViewManager->refreshView( addr.uid() );
846 editContact( addr.uid() ); 846 editContact( addr.uid() );
847 } 847 }
848#else //KAB_EMBEDDED 848#else //KAB_EMBEDDED
849 qDebug("KABCore::addEmail finsih method"); 849 qDebug("KABCore::addEmail finsih method");
850#endif //KAB_EMBEDDED 850#endif //KAB_EMBEDDED
851} 851}
852 852
853void KABCore::importVCard( const KURL &url, bool showPreview ) 853void KABCore::importVCard( const KURL &url, bool showPreview )
854{ 854{
855 mXXPortManager->importVCard( url, showPreview ); 855 mXXPortManager->importVCard( url, showPreview );
856} 856}
857void KABCore::importFromOL() 857void KABCore::importFromOL()
858{ 858{
859#ifdef _WIN32_ 859#ifdef _WIN32_
860 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 860 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
861 idgl->exec(); 861 idgl->exec();
862 KABC::Addressee::List list = idgl->getAddressList(); 862 KABC::Addressee::List list = idgl->getAddressList();
863 if ( list.count() > 0 ) { 863 if ( list.count() > 0 ) {
864 KABC::Addressee::List listNew; 864 KABC::Addressee::List listNew;
865 KABC::Addressee::List listExisting; 865 KABC::Addressee::List listExisting;
866 KABC::Addressee::List::Iterator it; 866 KABC::Addressee::List::Iterator it;
867 KABC::AddressBook::Iterator iter; 867 KABC::AddressBook::Iterator iter;
868 for ( it = list.begin(); it != list.end(); ++it ) { 868 for ( it = list.begin(); it != list.end(); ++it ) {
869 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 869 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
870 listNew.append( (*it) ); 870 listNew.append( (*it) );
871 else 871 else
872 listExisting.append( (*it) ); 872 listExisting.append( (*it) );
873 } 873 }
874 if ( listExisting.count() > 0 ) 874 if ( listExisting.count() > 0 )
875 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 875 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
876 if ( listNew.count() > 0 ) { 876 if ( listNew.count() > 0 ) {
877 pasteWithNewUid = false; 877 pasteWithNewUid = false;
878 pasteContacts( listNew ); 878 pasteContacts( listNew );
879 pasteWithNewUid = true; 879 pasteWithNewUid = true;
880 } 880 }
881 } 881 }
882 delete idgl; 882 delete idgl;
883#endif 883#endif
884} 884}
885 885
886void KABCore::importVCard( const QString &vCard, bool showPreview ) 886void KABCore::importVCard( const QString &vCard, bool showPreview )
887{ 887{
888 mXXPortManager->importVCard( vCard, showPreview ); 888 mXXPortManager->importVCard( vCard, showPreview );
889} 889}
890 890
891//US added a second method without defaultparameter 891//US added a second method without defaultparameter
892void KABCore::editContact2() { 892void KABCore::editContact2() {
893 editContact( QString::null ); 893 editContact( QString::null );
894} 894}
895 895
896void KABCore::editContact( const QString &uid ) 896void KABCore::editContact( const QString &uid )
897{ 897{
898 898
899 if ( mExtensionManager->isQuickEditVisible() ) 899 if ( mExtensionManager->isQuickEditVisible() )
900 return; 900 return;
901 901
902 // First, locate the contact entry 902 // First, locate the contact entry
903 QString localUID = uid; 903 QString localUID = uid;
904 if ( localUID.isNull() ) { 904 if ( localUID.isNull() ) {
905 QStringList uidList = mViewManager->selectedUids(); 905 QStringList uidList = mViewManager->selectedUids();
906 if ( uidList.count() > 0 ) 906 if ( uidList.count() > 0 )
907 localUID = *( uidList.at( 0 ) ); 907 localUID = *( uidList.at( 0 ) );
908 } 908 }
909 909
910 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 910 KABC::Addressee addr = mAddressBook->findByUid( localUID );
911 if ( !addr.isEmpty() ) { 911 if ( !addr.isEmpty() ) {
912 mEditorDialog->setAddressee( addr ); 912 mEditorDialog->setAddressee( addr );
913 KApplication::execDialog ( mEditorDialog ); 913 KApplication::execDialog ( mEditorDialog );
914 } 914 }
915} 915}
916 916
917void KABCore::save() 917void KABCore::save()
918{ 918{
919 if ( !mModified ) 919 if ( !mModified )
920 return; 920 return;
921 QString text = i18n( "There was an error while attempting to save\n the " 921 QString text = i18n( "There was an error while attempting to save\n the "
922 "address book. Please check that some \nother application is " 922 "address book. Please check that some \nother application is "
923 "not using it. " ); 923 "not using it. " );
924 statusMessage(i18n("Saving addressbook ... ")); 924 statusMessage(i18n("Saving addressbook ... "));
925#ifndef KAB_EMBEDDED 925#ifndef KAB_EMBEDDED
926 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 926 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
927 if ( !b || !b->save() ) { 927 if ( !b || !b->save() ) {
928 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 928 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
929 } 929 }
930#else //KAB_EMBEDDED 930#else //KAB_EMBEDDED
931 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 931 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
932 if ( !b || !b->save() ) { 932 if ( !b || !b->save() ) {
933 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 933 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
934 } 934 }
935#endif //KAB_EMBEDDED 935#endif //KAB_EMBEDDED
936 936
937 statusMessage(i18n("Addressbook saved!")); 937 statusMessage(i18n("Addressbook saved!"));
938 setModified( false ); 938 setModified( false );
939} 939}
940 940
941void KABCore::statusMessage(QString mess , int time ) 941void KABCore::statusMessage(QString mess , int time )
942{ 942{
943 //topLevelWidget()->setCaption( mess ); 943 //topLevelWidget()->setCaption( mess );
944 // pending setting timer to revome message 944 // pending setting timer to revome message
945} 945}
946void KABCore::undo() 946void KABCore::undo()
947{ 947{
948 UndoStack::instance()->undo(); 948 UndoStack::instance()->undo();
949 949
950 // Refresh the view 950 // Refresh the view
951 mViewManager->refreshView(); 951 mViewManager->refreshView();
952} 952}
953 953
954void KABCore::redo() 954void KABCore::redo()
955{ 955{
956 RedoStack::instance()->redo(); 956 RedoStack::instance()->redo();
957 957
958 // Refresh the view 958 // Refresh the view
959 mViewManager->refreshView(); 959 mViewManager->refreshView();
960} 960}
961 961
962void KABCore::setJumpButtonBarVisible( bool visible ) 962void KABCore::setJumpButtonBarVisible( bool visible )
963{ 963{
964 if ( visible ) 964 if ( visible )
965 mJumpButtonBar->show(); 965 mJumpButtonBar->show();
966 else 966 else
967 mJumpButtonBar->hide(); 967 mJumpButtonBar->hide();
968} 968}
969void KABCore::setDetailsToState() 969void KABCore::setDetailsToState()
970{ 970{
971 setDetailsVisible( mActionDetails->isChecked() ); 971 setDetailsVisible( mActionDetails->isChecked() );
972} 972}
973 973
974void KABCore::setDetailsVisible( bool visible ) 974void KABCore::setDetailsVisible( bool visible )
975{ 975{
976 if ( visible ) 976 if ( visible )
977 mDetails->show(); 977 mDetails->show();
978 else 978 else
979 mDetails->hide(); 979 mDetails->hide();
980} 980}
981 981
982void KABCore::extensionModified( const KABC::Addressee::List &list ) 982void KABCore::extensionModified( const KABC::Addressee::List &list )
983{ 983{
984 984
985 if ( list.count() != 0 ) { 985 if ( list.count() != 0 ) {
986 KABC::Addressee::List::ConstIterator it; 986 KABC::Addressee::List::ConstIterator it;
987 for ( it = list.begin(); it != list.end(); ++it ) 987 for ( it = list.begin(); it != list.end(); ++it )
988 mAddressBook->insertAddressee( *it ); 988 mAddressBook->insertAddressee( *it );
989 if ( list.count() > 1 ) 989 if ( list.count() > 1 )
990 setModified(); 990 setModified();
991 else 991 else
992 setModifiedWOrefresh(); 992 setModifiedWOrefresh();
993 } 993 }
994 if ( list.count() == 0 ) 994 if ( list.count() == 0 )
995 mViewManager->refreshView(); 995 mViewManager->refreshView();
996 else 996 else
997 mViewManager->refreshView( list[ 0 ].uid() ); 997 mViewManager->refreshView( list[ 0 ].uid() );
998 998
999 999
1000 1000
1001} 1001}
1002 1002
1003QString KABCore::getNameByPhone( const QString &phone ) 1003QString KABCore::getNameByPhone( const QString &phone )
1004{ 1004{
1005#ifndef KAB_EMBEDDED 1005#ifndef KAB_EMBEDDED
1006 QRegExp r( "[/*/-/ ]" ); 1006 QRegExp r( "[/*/-/ ]" );
1007 QString localPhone( phone ); 1007 QString localPhone( phone );
1008 1008
1009 bool found = false; 1009 bool found = false;
1010 QString ownerName = ""; 1010 QString ownerName = "";
1011 KABC::AddressBook::Iterator iter; 1011 KABC::AddressBook::Iterator iter;
1012 KABC::PhoneNumber::List::Iterator phoneIter; 1012 KABC::PhoneNumber::List::Iterator phoneIter;
1013 KABC::PhoneNumber::List phoneList; 1013 KABC::PhoneNumber::List phoneList;
1014 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1014 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1015 phoneList = (*iter).phoneNumbers(); 1015 phoneList = (*iter).phoneNumbers();
1016 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1016 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1017 ++phoneIter) { 1017 ++phoneIter) {
1018 // Get rid of separator chars so just the numbers are compared. 1018 // Get rid of separator chars so just the numbers are compared.
1019 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1019 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1020 ownerName = (*iter).formattedName(); 1020 ownerName = (*iter).formattedName();
1021 found = true; 1021 found = true;
1022 } 1022 }
1023 } 1023 }
1024 } 1024 }
1025 1025
1026 return ownerName; 1026 return ownerName;
1027#else //KAB_EMBEDDED 1027#else //KAB_EMBEDDED
1028 qDebug("KABCore::getNameByPhone finsih method"); 1028 qDebug("KABCore::getNameByPhone finsih method");
1029 return ""; 1029 return "";
1030#endif //KAB_EMBEDDED 1030#endif //KAB_EMBEDDED
1031 1031
1032} 1032}
1033 1033
1034void KABCore::openConfigDialog() 1034void KABCore::openConfigDialog()
1035{ 1035{
1036 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1036 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1037 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1037 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1038 ConfigureDialog->addModule(kabcfg ); 1038 ConfigureDialog->addModule(kabcfg );
1039 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1039 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1040 this, SLOT( configurationChanged() ) ); 1040 this, SLOT( configurationChanged() ) );
1041 connect( ConfigureDialog, SIGNAL( okClicked() ), 1041 connect( ConfigureDialog, SIGNAL( okClicked() ),
1042 this, SLOT( configurationChanged() ) ); 1042 this, SLOT( configurationChanged() ) );
1043 saveSettings(); 1043 saveSettings();
1044 ConfigureDialog->showMaximized(); 1044 ConfigureDialog->showMaximized();
1045 if ( ConfigureDialog->exec() ) 1045 if ( ConfigureDialog->exec() )
1046 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1046 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1047 delete ConfigureDialog; 1047 delete ConfigureDialog;
1048} 1048}
1049 1049
1050void KABCore::openLDAPDialog() 1050void KABCore::openLDAPDialog()
1051{ 1051{
1052#ifndef KAB_EMBEDDED 1052#ifndef KAB_EMBEDDED
1053 if ( !mLdapSearchDialog ) { 1053 if ( !mLdapSearchDialog ) {
1054 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1054 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1055 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1055 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1056 SLOT( refreshView() ) ); 1056 SLOT( refreshView() ) );
1057 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1057 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1058 SLOT( setModified() ) ); 1058 SLOT( setModified() ) );
1059 } else 1059 } else
1060 mLdapSearchDialog->restoreSettings(); 1060 mLdapSearchDialog->restoreSettings();
1061 1061
1062 if ( mLdapSearchDialog->isOK() ) 1062 if ( mLdapSearchDialog->isOK() )
1063 mLdapSearchDialog->exec(); 1063 mLdapSearchDialog->exec();
1064#else //KAB_EMBEDDED 1064#else //KAB_EMBEDDED
1065 qDebug("KABCore::openLDAPDialog() finsih method"); 1065 qDebug("KABCore::openLDAPDialog() finsih method");
1066#endif //KAB_EMBEDDED 1066#endif //KAB_EMBEDDED
1067} 1067}
1068 1068
1069void KABCore::print() 1069void KABCore::print()
1070{ 1070{
1071#ifndef KAB_EMBEDDED 1071#ifndef KAB_EMBEDDED
1072 KPrinter printer; 1072 KPrinter printer;
1073 if ( !printer.setup( this ) ) 1073 if ( !printer.setup( this ) )
1074 return; 1074 return;
1075 1075
1076 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1076 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1077 mViewManager->selectedUids(), this ); 1077 mViewManager->selectedUids(), this );
1078 1078
1079 wizard.exec(); 1079 wizard.exec();
1080#else //KAB_EMBEDDED 1080#else //KAB_EMBEDDED
1081 qDebug("KABCore::print() finsih method"); 1081 qDebug("KABCore::print() finsih method");
1082#endif //KAB_EMBEDDED 1082#endif //KAB_EMBEDDED
1083 1083
1084} 1084}
1085 1085
1086 1086
1087void KABCore::addGUIClient( KXMLGUIClient *client ) 1087void KABCore::addGUIClient( KXMLGUIClient *client )
1088{ 1088{
1089 if ( mGUIClient ) 1089 if ( mGUIClient )
1090 mGUIClient->insertChildClient( client ); 1090 mGUIClient->insertChildClient( client );
1091 else 1091 else
1092 KMessageBox::error( this, "no KXMLGUICLient"); 1092 KMessageBox::error( this, "no KXMLGUICLient");
1093} 1093}
1094 1094
1095 1095
1096void KABCore::configurationChanged() 1096void KABCore::configurationChanged()
1097{ 1097{
1098 mExtensionManager->reconfigure(); 1098 mExtensionManager->reconfigure();
1099} 1099}
1100 1100
1101void KABCore::addressBookChanged() 1101void KABCore::addressBookChanged()
1102{ 1102{
1103/*US 1103/*US
1104 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1104 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1105 while ( it.current() ) { 1105 while ( it.current() ) {
1106 if ( it.current()->dirty() ) { 1106 if ( it.current()->dirty() ) {
1107 QString text = i18n( "Data has been changed externally. Unsaved " 1107 QString text = i18n( "Data has been changed externally. Unsaved "
1108 "changes will be lost." ); 1108 "changes will be lost." );
1109 KMessageBox::information( this, text ); 1109 KMessageBox::information( this, text );
1110 } 1110 }
1111 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1111 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1112 ++it; 1112 ++it;
1113 } 1113 }
1114*/ 1114*/
1115 if (mEditorDialog) 1115 if (mEditorDialog)
1116 { 1116 {
1117 if (mEditorDialog->dirty()) 1117 if (mEditorDialog->dirty())
1118 { 1118 {
1119 QString text = i18n( "Data has been changed externally. Unsaved " 1119 QString text = i18n( "Data has been changed externally. Unsaved "
1120 "changes will be lost." ); 1120 "changes will be lost." );
1121 KMessageBox::information( this, text ); 1121 KMessageBox::information( this, text );
1122 } 1122 }
1123 QString currentuid = mEditorDialog->addressee().uid(); 1123 QString currentuid = mEditorDialog->addressee().uid();
1124 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1124 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1125 } 1125 }
1126 mViewManager->refreshView(); 1126 mViewManager->refreshView();
1127// mDetails->refreshView();
1127 1128
1128 1129
1129} 1130}
1130 1131
1131AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1132AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1132 const char *name ) 1133 const char *name )
1133{ 1134{
1134 1135
1135 if ( mEditorDialog == 0 ) { 1136 if ( mEditorDialog == 0 ) {
1136 mEditorDialog = new AddresseeEditorDialog( this, parent, 1137 mEditorDialog = new AddresseeEditorDialog( this, parent,
1137 name ? name : "editorDialog" ); 1138 name ? name : "editorDialog" );
1138 1139
1139 1140
1140 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1141 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1141 SLOT( contactModified( const KABC::Addressee& ) ) ); 1142 SLOT( contactModified( const KABC::Addressee& ) ) );
1142 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1143 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1143 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1144 // SLOT( slotEditorDestroyed( const QString& ) ) );
1144 } 1145 }
1145 1146
1146 return mEditorDialog; 1147 return mEditorDialog;
1147} 1148}
1148 1149
1149void KABCore::slotEditorDestroyed( const QString &uid ) 1150void KABCore::slotEditorDestroyed( const QString &uid )
1150{ 1151{
1151 //mEditorDict.remove( uid ); 1152 //mEditorDict.remove( uid );
1152} 1153}
1153 1154
1154void KABCore::initGUI() 1155void KABCore::initGUI()
1155{ 1156{
1156#ifndef KAB_EMBEDDED 1157#ifndef KAB_EMBEDDED
1157 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1158 QHBoxLayout *topLayout = new QHBoxLayout( this );
1158 topLayout->setSpacing( KDialogBase::spacingHint() ); 1159 topLayout->setSpacing( KDialogBase::spacingHint() );
1159 1160
1160 mExtensionBarSplitter = new QSplitter( this ); 1161 mExtensionBarSplitter = new QSplitter( this );
1161 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1162 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1162 1163
1163 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1164 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1164 1165
1165 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1166 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1166 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1167 mIncSearchWidget = new IncSearchWidget( viewSpace );
1167 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1168 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1168 SLOT( incrementalSearch( const QString& ) ) ); 1169 SLOT( incrementalSearch( const QString& ) ) );
1169 1170
1170 mViewManager = new ViewManager( this, viewSpace ); 1171 mViewManager = new ViewManager( this, viewSpace );
1171 viewSpace->setStretchFactor( mViewManager, 1 ); 1172 viewSpace->setStretchFactor( mViewManager, 1 );
1172 1173
1173 mDetails = new ViewContainer( mDetailsSplitter ); 1174 mDetails = new ViewContainer( mDetailsSplitter );
1174 1175
1175 mJumpButtonBar = new JumpButtonBar( this, this ); 1176 mJumpButtonBar = new JumpButtonBar( this, this );
1176 1177
1177 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1178 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1178 1179
1179 topLayout->addWidget( mExtensionBarSplitter ); 1180 topLayout->addWidget( mExtensionBarSplitter );
1180 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1181 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1181 topLayout->addWidget( mJumpButtonBar ); 1182 topLayout->addWidget( mJumpButtonBar );
1182 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1183 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1183 1184
1184 mXXPortManager = new XXPortManager( this, this ); 1185 mXXPortManager = new XXPortManager( this, this );
1185 1186
1186#else //KAB_EMBEDDED 1187#else //KAB_EMBEDDED
1187 //US initialize viewMenu before settingup viewmanager. 1188 //US initialize viewMenu before settingup viewmanager.
1188 // Viewmanager needs this menu to plugin submenues. 1189 // Viewmanager needs this menu to plugin submenues.
1189 viewMenu = new QPopupMenu( this ); 1190 viewMenu = new QPopupMenu( this );
1190 settingsMenu = new QPopupMenu( this ); 1191 settingsMenu = new QPopupMenu( this );
1191 //filterMenu = new QPopupMenu( this ); 1192 //filterMenu = new QPopupMenu( this );
1192 ImportMenu = new QPopupMenu( this ); 1193 ImportMenu = new QPopupMenu( this );
1193 ExportMenu = new QPopupMenu( this ); 1194 ExportMenu = new QPopupMenu( this );
1194 1195
1195 changeMenu= new QPopupMenu( this ); 1196 changeMenu= new QPopupMenu( this );
1196 1197
1197//US since we have no splitter for the embedded system, setup 1198//US since we have no splitter for the embedded system, setup
1198// a layout with two frames. One left and one right. 1199// a layout with two frames. One left and one right.
1199 1200
1200 QBoxLayout *topLayout; 1201 QBoxLayout *topLayout;
1201 1202
1202 // = new QHBoxLayout( this ); 1203 // = new QHBoxLayout( this );
1203// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1204// QBoxLayout *topLayout = (QBoxLayout*)layout();
1204 1205
1205// QWidget *mainBox = new QWidget( this ); 1206// QWidget *mainBox = new QWidget( this );
1206// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1207// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1207 1208
1208#ifdef DESKTOP_VERSION 1209#ifdef DESKTOP_VERSION
1209 topLayout = new QHBoxLayout( this ); 1210 topLayout = new QHBoxLayout( this );
1210 1211
1211 1212
1212 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1213 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1213 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1214 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1214 1215
1215 topLayout->addWidget(mMiniSplitter ); 1216 topLayout->addWidget(mMiniSplitter );
1216 1217
1217 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1218 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1218 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1219 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1219 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1220 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1220 mDetails = new ViewContainer( mMiniSplitter ); 1221 mDetails = new ViewContainer( mMiniSplitter );
1221 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1222 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1222#else 1223#else
1223 if ( QApplication::desktop()->width() > 480 ) { 1224 if ( QApplication::desktop()->width() > 480 ) {
1224 topLayout = new QHBoxLayout( this ); 1225 topLayout = new QHBoxLayout( this );
1225 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1226 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1226 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1227 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1227 } else { 1228 } else {
1228 1229
1229 topLayout = new QHBoxLayout( this ); 1230 topLayout = new QHBoxLayout( this );
1230 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1231 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1231 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1232 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1232 } 1233 }
1233 1234
1234 topLayout->addWidget(mMiniSplitter ); 1235 topLayout->addWidget(mMiniSplitter );
1235 mViewManager = new ViewManager( this, mMiniSplitter ); 1236 mViewManager = new ViewManager( this, mMiniSplitter );
1236 mDetails = new ViewContainer( mMiniSplitter ); 1237 mDetails = new ViewContainer( mMiniSplitter );
1237 1238
1238 1239
1239 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1240 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1240#endif 1241#endif
1241 //eh->hide(); 1242 //eh->hide();
1242 // topLayout->addWidget(mExtensionManager ); 1243 // topLayout->addWidget(mExtensionManager );
1243 1244
1244 1245
1245/*US 1246/*US
1246#ifndef KAB_NOSPLITTER 1247#ifndef KAB_NOSPLITTER
1247 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1248 QHBoxLayout *topLayout = new QHBoxLayout( this );
1248//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1249//US topLayout->setSpacing( KDialogBase::spacingHint() );
1249 topLayout->setSpacing( 10 ); 1250 topLayout->setSpacing( 10 );
1250 1251
1251 mDetailsSplitter = new QSplitter( this ); 1252 mDetailsSplitter = new QSplitter( this );
1252 1253
1253 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1254 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1254 1255
1255 mViewManager = new ViewManager( this, viewSpace ); 1256 mViewManager = new ViewManager( this, viewSpace );
1256 viewSpace->setStretchFactor( mViewManager, 1 ); 1257 viewSpace->setStretchFactor( mViewManager, 1 );
1257 1258
1258 mDetails = new ViewContainer( mDetailsSplitter ); 1259 mDetails = new ViewContainer( mDetailsSplitter );
1259 1260
1260 topLayout->addWidget( mDetailsSplitter ); 1261 topLayout->addWidget( mDetailsSplitter );
1261 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1262 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1262#else //KAB_NOSPLITTER 1263#else //KAB_NOSPLITTER
1263 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1264 QHBoxLayout *topLayout = new QHBoxLayout( this );
1264//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1265//US topLayout->setSpacing( KDialogBase::spacingHint() );
1265 topLayout->setSpacing( 10 ); 1266 topLayout->setSpacing( 10 );
1266 1267
1267// mDetailsSplitter = new QSplitter( this ); 1268// mDetailsSplitter = new QSplitter( this );
1268 1269
1269 QVBox *viewSpace = new QVBox( this ); 1270 QVBox *viewSpace = new QVBox( this );
1270 1271
1271 mViewManager = new ViewManager( this, viewSpace ); 1272 mViewManager = new ViewManager( this, viewSpace );
1272 viewSpace->setStretchFactor( mViewManager, 1 ); 1273 viewSpace->setStretchFactor( mViewManager, 1 );
1273 1274
1274 mDetails = new ViewContainer( this ); 1275 mDetails = new ViewContainer( this );
1275 1276
1276 topLayout->addWidget( viewSpace ); 1277 topLayout->addWidget( viewSpace );
1277// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1278// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1278 topLayout->addWidget( mDetails ); 1279 topLayout->addWidget( mDetails );
1279#endif //KAB_NOSPLITTER 1280#endif //KAB_NOSPLITTER
1280*/ 1281*/
1281 1282
1282 1283
1283#endif //KAB_EMBEDDED 1284#endif //KAB_EMBEDDED
1284 initActions(); 1285 initActions();
1285 1286
1286#ifdef KAB_EMBEDDED 1287#ifdef KAB_EMBEDDED
1287 addActionsManually(); 1288 addActionsManually();
1288 //US make sure the export and import menues are initialized before creating the xxPortManager. 1289 //US make sure the export and import menues are initialized before creating the xxPortManager.
1289 mXXPortManager = new XXPortManager( this, this ); 1290 mXXPortManager = new XXPortManager( this, this );
1290 1291
1291 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1292 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1292 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1293 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1293 // mActionQuit->plug ( mMainWindow->toolBar()); 1294 // mActionQuit->plug ( mMainWindow->toolBar());
1294 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1295 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1295 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1296 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1296 // mIncSearchWidget->hide(); 1297 // mIncSearchWidget->hide();
1297 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1298 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1298 SLOT( incrementalSearch( const QString& ) ) ); 1299 SLOT( incrementalSearch( const QString& ) ) );
1299 1300
1300 1301
1301 mJumpButtonBar = new JumpButtonBar( this, this ); 1302 mJumpButtonBar = new JumpButtonBar( this, this );
1302 1303
1303 topLayout->addWidget( mJumpButtonBar ); 1304 topLayout->addWidget( mJumpButtonBar );
1304//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1305//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1305 1306
1306// mMainWindow->getIconToolBar()->raise(); 1307// mMainWindow->getIconToolBar()->raise();
1307 1308
1308#endif //KAB_EMBEDDED 1309#endif //KAB_EMBEDDED
1309 1310
1310} 1311}
1311void KABCore::initActions() 1312void KABCore::initActions()
1312{ 1313{
1313//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1314//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1314 1315
1315#ifndef KAB_EMBEDDED 1316#ifndef KAB_EMBEDDED
1316 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1317 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1317 SLOT( clipboardDataChanged() ) ); 1318 SLOT( clipboardDataChanged() ) );
1318#endif //KAB_EMBEDDED 1319#endif //KAB_EMBEDDED
1319 1320
1320 // file menu 1321 // file menu
1321 if ( mIsPart ) { 1322 if ( mIsPart ) {
1322 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1323 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1323 SLOT( sendMail() ), actionCollection(), 1324 SLOT( sendMail() ), actionCollection(),
1324 "kaddressbook_mail" ); 1325 "kaddressbook_mail" );
1325 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1326 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1326 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1327 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1327 1328
1328 } else { 1329 } else {
1329 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1330 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1330 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1331 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1331 } 1332 }
1332 1333
1333 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1334 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1334 SLOT( save() ), actionCollection(), "file_sync" ); 1335 SLOT( save() ), actionCollection(), "file_sync" );
1335 1336
1336 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1337 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1337 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1338 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1338 1339
1339 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1340 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1340 this, SLOT( mailVCard() ), 1341 this, SLOT( mailVCard() ),
1341 actionCollection(), "file_mail_vcard"); 1342 actionCollection(), "file_mail_vcard");
1342 1343
1343 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1344 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1344 this, SLOT( editContact2() ), 1345 this, SLOT( editContact2() ),
1345 actionCollection(), "file_properties" ); 1346 actionCollection(), "file_properties" );
1346 1347
1347#ifdef KAB_EMBEDDED 1348#ifdef KAB_EMBEDDED
1348 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1349 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1349 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1350 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1350 mMainWindow, SLOT( exit() ), 1351 mMainWindow, SLOT( exit() ),
1351 actionCollection(), "quit" ); 1352 actionCollection(), "quit" );
1352#endif //KAB_EMBEDDED 1353#endif //KAB_EMBEDDED
1353 1354
1354 // edit menu 1355 // edit menu
1355 if ( mIsPart ) { 1356 if ( mIsPart ) {
1356 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1357 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1357 SLOT( copyContacts() ), actionCollection(), 1358 SLOT( copyContacts() ), actionCollection(),
1358 "kaddressbook_copy" ); 1359 "kaddressbook_copy" );
1359 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1360 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1360 SLOT( cutContacts() ), actionCollection(), 1361 SLOT( cutContacts() ), actionCollection(),
1361 "kaddressbook_cut" ); 1362 "kaddressbook_cut" );
1362 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1363 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1363 SLOT( pasteContacts() ), actionCollection(), 1364 SLOT( pasteContacts() ), actionCollection(),
1364 "kaddressbook_paste" ); 1365 "kaddressbook_paste" );
1365 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1366 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1366 SLOT( selectAllContacts() ), actionCollection(), 1367 SLOT( selectAllContacts() ), actionCollection(),
1367 "kaddressbook_select_all" ); 1368 "kaddressbook_select_all" );
1368 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1369 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1369 SLOT( undo() ), actionCollection(), 1370 SLOT( undo() ), actionCollection(),
1370 "kaddressbook_undo" ); 1371 "kaddressbook_undo" );
1371 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1372 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1372 this, SLOT( redo() ), actionCollection(), 1373 this, SLOT( redo() ), actionCollection(),
1373 "kaddressbook_redo" ); 1374 "kaddressbook_redo" );
1374 } else { 1375 } else {
1375 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1376 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1376 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1377 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1377 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1378 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1378 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1379 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1379 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1380 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1380 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1381 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1381 } 1382 }
1382 1383
1383 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1384 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1384 Key_Delete, this, SLOT( deleteContacts() ), 1385 Key_Delete, this, SLOT( deleteContacts() ),
1385 actionCollection(), "edit_delete" ); 1386 actionCollection(), "edit_delete" );
1386 1387
1387 mActionUndo->setEnabled( false ); 1388 mActionUndo->setEnabled( false );
1388 mActionRedo->setEnabled( false ); 1389 mActionRedo->setEnabled( false );
1389 1390
1390 // settings menu 1391 // settings menu
1391#ifdef KAB_EMBEDDED 1392#ifdef KAB_EMBEDDED
1392//US special menuentry to configure the addressbook resources. On KDE 1393//US special menuentry to configure the addressbook resources. On KDE
1393// you do that through the control center !!! 1394// you do that through the control center !!!
1394 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1395 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1395 SLOT( configureResources() ), actionCollection(), 1396 SLOT( configureResources() ), actionCollection(),
1396 "kaddressbook_configure_resources" ); 1397 "kaddressbook_configure_resources" );
1397#endif //KAB_EMBEDDED 1398#endif //KAB_EMBEDDED
1398 1399
1399 if ( mIsPart ) { 1400 if ( mIsPart ) {
1400 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1401 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1401 SLOT( openConfigDialog() ), actionCollection(), 1402 SLOT( openConfigDialog() ), actionCollection(),
1402 "kaddressbook_configure" ); 1403 "kaddressbook_configure" );
1403 1404
1404 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1405 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1405 this, SLOT( configureKeyBindings() ), actionCollection(), 1406 this, SLOT( configureKeyBindings() ), actionCollection(),
1406 "kaddressbook_configure_shortcuts" ); 1407 "kaddressbook_configure_shortcuts" );
1407#ifdef KAB_EMBEDDED 1408#ifdef KAB_EMBEDDED
1408 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1409 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1409 mActionConfigureToolbars->setEnabled( false ); 1410 mActionConfigureToolbars->setEnabled( false );
1410#endif //KAB_EMBEDDED 1411#endif //KAB_EMBEDDED
1411 1412
1412 } else { 1413 } else {
1413 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1414 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1414 1415
1415 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1416 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1416 } 1417 }
1417 1418
1418 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1419 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1419 actionCollection(), "options_show_jump_bar" ); 1420 actionCollection(), "options_show_jump_bar" );
1420 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1421 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1421 1422
1422 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1423 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1423 actionCollection(), "options_show_details" ); 1424 actionCollection(), "options_show_details" );
1424 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1425 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1425 1426
1426 // misc 1427 // misc
1427 // only enable LDAP lookup if we can handle the protocol 1428 // only enable LDAP lookup if we can handle the protocol
1428#ifndef KAB_EMBEDDED 1429#ifndef KAB_EMBEDDED
1429 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1430 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1430 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1431 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1431 this, SLOT( openLDAPDialog() ), actionCollection(), 1432 this, SLOT( openLDAPDialog() ), actionCollection(),
1432 "ldap_lookup" ); 1433 "ldap_lookup" );
1433 } 1434 }
1434#else //KAB_EMBEDDED 1435#else //KAB_EMBEDDED
1435 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1436 //qDebug("KABCore::initActions() LDAP has to be implemented");
1436#endif //KAB_EMBEDDED 1437#endif //KAB_EMBEDDED
1437 1438
1438 1439
1439 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1440 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1440 SLOT( setWhoAmI() ), actionCollection(), 1441 SLOT( setWhoAmI() ), actionCollection(),
1441 "set_personal" ); 1442 "set_personal" );
1442 1443
1443 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1444 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1444 SLOT( setCategories() ), actionCollection(), 1445 SLOT( setCategories() ), actionCollection(),
1445 "edit_set_categories" ); 1446 "edit_set_categories" );
1446 1447
1447 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1448 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1448 SLOT( removeVoice() ), actionCollection(), 1449 SLOT( removeVoice() ), actionCollection(),
1449 "remove_voice" ); 1450 "remove_voice" );
1450 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1451 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1451 SLOT( importFromOL() ), actionCollection(), 1452 SLOT( importFromOL() ), actionCollection(),
1452 "import_OL" ); 1453 "import_OL" );
1453#ifdef KAB_EMBEDDED 1454#ifdef KAB_EMBEDDED
1454 1455
1455 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1456 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1456 this, SLOT( createAboutData() ), actionCollection(), 1457 this, SLOT( createAboutData() ), actionCollection(),
1457 "kaddressbook_about_data" ); 1458 "kaddressbook_about_data" );
1458#endif //KAB_EMBEDDED 1459#endif //KAB_EMBEDDED
1459 1460
1460 clipboardDataChanged(); 1461 clipboardDataChanged();
1461 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1462 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1462 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1463 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1463} 1464}
1464 1465
1465//US we need this function, to plug all actions into the correct menues. 1466//US we need this function, to plug all actions into the correct menues.
1466// KDE uses a XML format to plug the actions, but we work her without this overhead. 1467// KDE uses a XML format to plug the actions, but we work her without this overhead.
1467void KABCore::addActionsManually() 1468void KABCore::addActionsManually()
1468{ 1469{
1469//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1470//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1470 1471
1471#ifdef KAB_EMBEDDED 1472#ifdef KAB_EMBEDDED
1472 QPopupMenu *fileMenu = new QPopupMenu( this ); 1473 QPopupMenu *fileMenu = new QPopupMenu( this );
1473 QPopupMenu *editMenu = new QPopupMenu( this ); 1474 QPopupMenu *editMenu = new QPopupMenu( this );
1474 QPopupMenu *helpMenu = new QPopupMenu( this ); 1475 QPopupMenu *helpMenu = new QPopupMenu( this );
1475 1476
1476 KToolBar* tb = mMainWindow->toolBar(); 1477 KToolBar* tb = mMainWindow->toolBar();
1477 1478
1478#ifdef DESKTOP_VERSION 1479#ifdef DESKTOP_VERSION
1479 QMenuBar* mb = mMainWindow->menuBar(); 1480 QMenuBar* mb = mMainWindow->menuBar();
1480 1481
1481 //US setup menubar. 1482 //US setup menubar.
1482 //Disable the following block if you do not want to have a menubar. 1483 //Disable the following block if you do not want to have a menubar.
1483 mb->insertItem( "&File", fileMenu ); 1484 mb->insertItem( "&File", fileMenu );
1484 mb->insertItem( "&Edit", editMenu ); 1485 mb->insertItem( "&Edit", editMenu );
1485 mb->insertItem( "&View", viewMenu ); 1486 mb->insertItem( "&View", viewMenu );
1486 mb->insertItem( "&Settings", settingsMenu ); 1487 mb->insertItem( "&Settings", settingsMenu );
1487 mb->insertItem( "&Change selected", changeMenu ); 1488 mb->insertItem( "&Change selected", changeMenu );
1488 mb->insertItem( "&Help", helpMenu ); 1489 mb->insertItem( "&Help", helpMenu );
1489 mIncSearchWidget = new IncSearchWidget( tb ); 1490 mIncSearchWidget = new IncSearchWidget( tb );
1490 // tb->insertWidget(-1, 0, mIncSearchWidget); 1491 // tb->insertWidget(-1, 0, mIncSearchWidget);
1491 1492
1492#else 1493#else
1493 //US setup toolbar 1494 //US setup toolbar
1494 QMenuBar *menuBarTB = new QMenuBar( tb ); 1495 QMenuBar *menuBarTB = new QMenuBar( tb );
1495 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1496 QPopupMenu *popupBarTB = new QPopupMenu( this );
1496 menuBarTB->insertItem( "ME", popupBarTB); 1497 menuBarTB->insertItem( "ME", popupBarTB);
1497 tb->insertWidget(-1, 0, menuBarTB); 1498 tb->insertWidget(-1, 0, menuBarTB);
1498 mIncSearchWidget = new IncSearchWidget( tb ); 1499 mIncSearchWidget = new IncSearchWidget( tb );
1499 1500
1500 tb->enableMoving(false); 1501 tb->enableMoving(false);
1501 popupBarTB->insertItem( "&File", fileMenu ); 1502 popupBarTB->insertItem( "&File", fileMenu );
1502 popupBarTB->insertItem( "&Edit", editMenu ); 1503 popupBarTB->insertItem( "&Edit", editMenu );
1503 popupBarTB->insertItem( "&View", viewMenu ); 1504 popupBarTB->insertItem( "&View", viewMenu );
1504 popupBarTB->insertItem( "&Settings", settingsMenu ); 1505 popupBarTB->insertItem( "&Settings", settingsMenu );
1505 mViewManager->getFilterAction()->plug ( popupBarTB); 1506 mViewManager->getFilterAction()->plug ( popupBarTB);
1506 popupBarTB->insertItem( "&Change selected", changeMenu ); 1507 popupBarTB->insertItem( "&Change selected", changeMenu );
1507 popupBarTB->insertItem( "&Help", helpMenu ); 1508 popupBarTB->insertItem( "&Help", helpMenu );
1508 if (QApplication::desktop()->width() > 320 ) { 1509 if (QApplication::desktop()->width() > 320 ) {
1509 // mViewManager->getFilterAction()->plug ( tb); 1510 // mViewManager->getFilterAction()->plug ( tb);
1510 } 1511 }