author | zautrix <zautrix> | 2005-03-30 17:55:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-30 17:55:57 (UTC) |
commit | 0d8be3961052dc4396aa7db1c5f50db3ec1ac194 (patch) (unidiff) | |
tree | f823a8b81413f16f861c9c91ef753d3627577cb2 | |
parent | 95ec57b2f9df64dc40067c3a2278438029517f4c (diff) | |
download | kdepimpi-0d8be3961052dc4396aa7db1c5f50db3ec1ac194.zip kdepimpi-0d8be3961052dc4396aa7db1c5f50db3ec1ac194.tar.gz kdepimpi-0d8be3961052dc4396aa7db1c5f50db3ec1ac194.tar.bz2 |
MENU CLEANUP
-rw-r--r-- | kaddressbook/extensionmanager.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 28 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 2 |
3 files changed, 17 insertions, 17 deletions
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp index efbdf17..46defa1 100644 --- a/kaddressbook/extensionmanager.cpp +++ b/kaddressbook/extensionmanager.cpp | |||
@@ -1,248 +1,248 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
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 | 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 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <kactionclasses.h> | 25 | #include <kactionclasses.h> |
26 | #include <kconfig.h> | 26 | #include <kconfig.h> |
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | 29 | ||
30 | #ifndef KAB_EMBEDDED | 30 | #ifndef KAB_EMBEDDED |
31 | #include <ktrader.h> | 31 | #include <ktrader.h> |
32 | #else //KAB_EMBEDDED | 32 | #else //KAB_EMBEDDED |
33 | #include <features/mergewidget.h> | 33 | #include <features/mergewidget.h> |
34 | #include <features/distributionlistwidget.h> | 34 | #include <features/distributionlistwidget.h> |
35 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
36 | 36 | ||
37 | #include "addresseeeditorwidget.h" | 37 | #include "addresseeeditorwidget.h" |
38 | #include "kabcore.h" | 38 | #include "kabcore.h" |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | 40 | ||
41 | #include "extensionmanager.h" | 41 | #include "extensionmanager.h" |
42 | 42 | ||
43 | ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, | 43 | ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, |
44 | const char *name ) | 44 | const char *name ) |
45 | : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) | 45 | : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) |
46 | { | 46 | { |
47 | #ifdef KAB_EMBEDDED | 47 | #ifdef KAB_EMBEDDED |
48 | //US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 48 | //US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
49 | QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu(); | 49 | QWidget *settingsmenu = (QWidget*)mCore->getViewMenu(); |
50 | #endif //KAB_EMBEDDED | 50 | #endif //KAB_EMBEDDED |
51 | 51 | ||
52 | mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, | 52 | mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, |
53 | mCore->actionCollection(), | 53 | mCore->actionCollection(), |
54 | "options_show_extensions" ); | 54 | "options_show_extensions" ); |
55 | 55 | ||
56 | mActionExtensions->plug( settingsmenu ); | 56 | mActionExtensions->plug( settingsmenu ,0); |
57 | 57 | ||
58 | connect( mActionExtensions, SIGNAL( activated( int ) ), | 58 | connect( mActionExtensions, SIGNAL( activated( int ) ), |
59 | SLOT( setActiveExtension( int ) ) ); | 59 | SLOT( setActiveExtension( int ) ) ); |
60 | mWidgetBox = new QWidget( viewport() ); | 60 | mWidgetBox = new QWidget( viewport() ); |
61 | new QHBoxLayout (mWidgetBox ); | 61 | new QHBoxLayout (mWidgetBox ); |
62 | addChild( mWidgetBox ); | 62 | addChild( mWidgetBox ); |
63 | setResizePolicy(AutoOneFit); | 63 | setResizePolicy(AutoOneFit); |
64 | createExtensionWidgets(); | 64 | createExtensionWidgets(); |
65 | hide(); | 65 | hide(); |
66 | } | 66 | } |
67 | 67 | ||
68 | ExtensionManager::~ExtensionManager() | 68 | ExtensionManager::~ExtensionManager() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void ExtensionManager::restoreSettings() | 72 | void ExtensionManager::restoreSettings() |
73 | { | 73 | { |
74 | mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension ); | 74 | mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension ); |
75 | int i = 1; | 75 | int i = 1; |
76 | mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 ); | 76 | mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 ); |
77 | while ( mCurrentExtensionWidget ) { | 77 | while ( mCurrentExtensionWidget ) { |
78 | if( i != KABPrefs::instance()->mCurrentExtension ) | 78 | if( i != KABPrefs::instance()->mCurrentExtension ) |
79 | mCurrentExtensionWidget->hide(); | 79 | mCurrentExtensionWidget->hide(); |
80 | mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 ); | 80 | mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 ); |
81 | 81 | ||
82 | } | 82 | } |
83 | setActiveExtension( mActionExtensions->currentItem() ); | 83 | setActiveExtension( mActionExtensions->currentItem() ); |
84 | } | 84 | } |
85 | 85 | ||
86 | void ExtensionManager::saveSettings() | 86 | void ExtensionManager::saveSettings() |
87 | { | 87 | { |
88 | KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem(); | 88 | KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem(); |
89 | } | 89 | } |
90 | 90 | ||
91 | void ExtensionManager::reconfigure() | 91 | void ExtensionManager::reconfigure() |
92 | { | 92 | { |
93 | saveSettings(); | 93 | saveSettings(); |
94 | createExtensionWidgets(); | 94 | createExtensionWidgets(); |
95 | restoreSettings(); | 95 | restoreSettings(); |
96 | } | 96 | } |
97 | 97 | ||
98 | bool ExtensionManager::isQuickEditVisible() const | 98 | bool ExtensionManager::isQuickEditVisible() const |
99 | { | 99 | { |
100 | return ( mCurrentExtensionWidget && | 100 | return ( mCurrentExtensionWidget && |
101 | mCurrentExtensionWidget->identifier() == "contact_editor" ); | 101 | mCurrentExtensionWidget->identifier() == "contact_editor" ); |
102 | } | 102 | } |
103 | 103 | ||
104 | void ExtensionManager::setSelectionChanged() | 104 | void ExtensionManager::setSelectionChanged() |
105 | { | 105 | { |
106 | if ( mCurrentExtensionWidget ) | 106 | if ( mCurrentExtensionWidget ) |
107 | mCurrentExtensionWidget->contactsSelectionChanged(); | 107 | mCurrentExtensionWidget->contactsSelectionChanged(); |
108 | } | 108 | } |
109 | 109 | ||
110 | void ExtensionManager::setActiveExtension( int id ) | 110 | void ExtensionManager::setActiveExtension( int id ) |
111 | { | 111 | { |
112 | //qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id); | 112 | //qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id); |
113 | if ( id == 0 ) { | 113 | if ( id == 0 ) { |
114 | hide(); | 114 | hide(); |
115 | mCurrentExtensionWidget = 0; | 115 | mCurrentExtensionWidget = 0; |
116 | #ifndef DESKTOP_VERSION | 116 | #ifndef DESKTOP_VERSION |
117 | //US our screen is so small, that we better hide the detailscreen, just in case. | 117 | //US our screen is so small, that we better hide the detailscreen, just in case. |
118 | //US mCore->setDetailsToState( ); | 118 | //US mCore->setDetailsToState( ); |
119 | #endif //KAB_EMBEDDED | 119 | #endif //KAB_EMBEDDED |
120 | } else if ( id > 0 ) { | 120 | } else if ( id > 0 ) { |
121 | if ( mCurrentExtensionWidget ) | 121 | if ( mCurrentExtensionWidget ) |
122 | mCurrentExtensionWidget->hide(); | 122 | mCurrentExtensionWidget->hide(); |
123 | 123 | ||
124 | mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 ); | 124 | mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 ); |
125 | 125 | ||
126 | if ( mCurrentExtensionWidget ) { | 126 | if ( mCurrentExtensionWidget ) { |
127 | #ifndef DESKTOP_VERSION | 127 | #ifndef DESKTOP_VERSION |
128 | //US our screen is so small, that we better hide the detailscreen, just in case. | 128 | //US our screen is so small, that we better hide the detailscreen, just in case. |
129 | //US mCore->setDetailsVisible( false ); | 129 | //US mCore->setDetailsVisible( false ); |
130 | #endif //KAB_EMBEDDED | 130 | #endif //KAB_EMBEDDED |
131 | show(); | 131 | show(); |
132 | mWidgetBox->show(); | 132 | mWidgetBox->show(); |
133 | mCurrentExtensionWidget->show(); | 133 | mCurrentExtensionWidget->show(); |
134 | } else { | 134 | } else { |
135 | hide(); | 135 | hide(); |
136 | mCurrentExtensionWidget = 0; | 136 | mCurrentExtensionWidget = 0; |
137 | #ifndef DESKTOP_VERSION | 137 | #ifndef DESKTOP_VERSION |
138 | //US our screen is so small, that we better hide the detailscreen, just in case. | 138 | //US our screen is so small, that we better hide the detailscreen, just in case. |
139 | //US mCore->setDetailsToState( ); | 139 | //US mCore->setDetailsToState( ); |
140 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | emit changedActiveExtension( id ); | 144 | emit changedActiveExtension( id ); |
145 | } | 145 | } |
146 | 146 | ||
147 | void ExtensionManager::createExtensionWidgets() | 147 | void ExtensionManager::createExtensionWidgets() |
148 | { | 148 | { |
149 | // clear extension widget list | 149 | // clear extension widget list |
150 | mExtensionWidgetList.setAutoDelete( true ); | 150 | mExtensionWidgetList.setAutoDelete( true ); |
151 | QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); | 151 | QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); |
152 | ExtensionWidget *wdg = 0; | 152 | ExtensionWidget *wdg = 0; |
153 | while ( ( wdg = wdgIt.current() ) != 0 ) | 153 | while ( ( wdg = wdgIt.current() ) != 0 ) |
154 | mExtensionWidgetList.remove( wdg ); | 154 | mExtensionWidgetList.remove( wdg ); |
155 | 155 | ||
156 | mExtensionWidgetList.setAutoDelete( false ); | 156 | mExtensionWidgetList.setAutoDelete( false ); |
157 | 157 | ||
158 | QStringList extensionNames( i18n( "None" ) ); | 158 | QStringList extensionNames( i18n( "None" ) ); |
159 | 159 | ||
160 | // add addressee editor as default | 160 | // add addressee editor as default |
161 | 161 | ||
162 | QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();; | 162 | QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();; |
163 | 163 | ||
164 | wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); | 164 | wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); |
165 | hbl->addWidget( wdg ); | 165 | hbl->addWidget( wdg ); |
166 | //wdg->hide(); | 166 | //wdg->hide(); |
167 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 167 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
168 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 168 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
169 | mExtensionWidgetList.append( wdg ); | 169 | mExtensionWidgetList.append( wdg ); |
170 | extensionNames.append( wdg->title() ); | 170 | extensionNames.append( wdg->title() ); |
171 | 171 | ||
172 | // load the other extensions | 172 | // load the other extensions |
173 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 173 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
174 | 174 | ||
175 | #ifndef KAB_EMBEDDED | 175 | #ifndef KAB_EMBEDDED |
176 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 176 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
177 | KTrader::OfferList::ConstIterator it; | 177 | KTrader::OfferList::ConstIterator it; |
178 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 178 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
179 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 179 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
180 | continue; | 180 | continue; |
181 | 181 | ||
182 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 182 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
183 | if ( !factory ) { | 183 | if ( !factory ) { |
184 | //kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl; | 184 | //kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl; |
185 | continue; | 185 | continue; |
186 | } | 186 | } |
187 | 187 | ||
188 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 188 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
189 | 189 | ||
190 | if ( !extensionFactory ) { | 190 | if ( !extensionFactory ) { |
191 | //kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl; | 191 | //kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl; |
192 | continue; | 192 | continue; |
193 | } | 193 | } |
194 | 194 | ||
195 | if ( !activeExtensions.contains( extensionFactory->identifier() ) ) | 195 | if ( !activeExtensions.contains( extensionFactory->identifier() ) ) |
196 | continue; | 196 | continue; |
197 | 197 | ||
198 | wdg = extensionFactory->extension( mCore, this ); | 198 | wdg = extensionFactory->extension( mCore, this ); |
199 | if ( wdg ) { | 199 | if ( wdg ) { |
200 | //wdg->hide(); | 200 | //wdg->hide(); |
201 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 201 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
202 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 202 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
203 | mExtensionWidgetList.append( wdg ); | 203 | mExtensionWidgetList.append( wdg ); |
204 | extensionNames.append( wdg->title() ); | 204 | extensionNames.append( wdg->title() ); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | #else //KAB_EMBEDDED | 207 | #else //KAB_EMBEDDED |
208 | //load Mergefactory/extension | 208 | //load Mergefactory/extension |
209 | ExtensionFactory *extensionFactory = new MergeFactory(); | 209 | ExtensionFactory *extensionFactory = new MergeFactory(); |
210 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 210 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
211 | { | 211 | { |
212 | wdg = extensionFactory->extension( mCore, mWidgetBox ); | 212 | wdg = extensionFactory->extension( mCore, mWidgetBox ); |
213 | if ( wdg ) { | 213 | if ( wdg ) { |
214 | hbl->addWidget( wdg ); | 214 | hbl->addWidget( wdg ); |
215 | //wdg->hide(); | 215 | //wdg->hide(); |
216 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 216 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
217 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 217 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
218 | mExtensionWidgetList.append( wdg ); | 218 | mExtensionWidgetList.append( wdg ); |
219 | extensionNames.append( wdg->title() ); | 219 | extensionNames.append( wdg->title() ); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | //load DistributionListfactory/extension | 223 | //load DistributionListfactory/extension |
224 | extensionFactory = new DistributionListFactory(); | 224 | extensionFactory = new DistributionListFactory(); |
225 | if (activeExtensions.contains( extensionFactory->identifier() ) ) | 225 | if (activeExtensions.contains( extensionFactory->identifier() ) ) |
226 | { | 226 | { |
227 | wdg = extensionFactory->extension( mCore, mWidgetBox ); | 227 | wdg = extensionFactory->extension( mCore, mWidgetBox ); |
228 | if ( wdg ) { | 228 | if ( wdg ) { |
229 | hbl->addWidget( wdg ); | 229 | hbl->addWidget( wdg ); |
230 | //wdg->hide(); | 230 | //wdg->hide(); |
231 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 231 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
232 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 232 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
233 | mExtensionWidgetList.append( wdg ); | 233 | mExtensionWidgetList.append( wdg ); |
234 | extensionNames.append( wdg->title() ); | 234 | extensionNames.append( wdg->title() ); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | hbl->addStretch(); | 238 | hbl->addStretch(); |
239 | 239 | ||
240 | #endif //KAB_EMBEDDED | 240 | #endif //KAB_EMBEDDED |
241 | 241 | ||
242 | 242 | ||
243 | mActionExtensions->setItems( extensionNames ); | 243 | mActionExtensions->setItems( extensionNames ); |
244 | mCurrentExtensionWidget = 0; | 244 | mCurrentExtensionWidget = 0; |
245 | } | 245 | } |
246 | 246 | ||
247 | #ifndef KAB_EMBEDDED | 247 | #ifndef KAB_EMBEDDED |
248 | #include "extensionmanager.moc" | 248 | #include "extensionmanager.moc" |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 1433568..5ef61b1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1941,523 +1941,523 @@ void KABCore::initActions() | |||
1941 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1941 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1942 | SLOT( export2phone() ), actionCollection(), | 1942 | SLOT( export2phone() ), actionCollection(), |
1943 | "kaddressbook_ex2phone" ); | 1943 | "kaddressbook_ex2phone" ); |
1944 | 1944 | ||
1945 | mActionBeamVCard = 0; | 1945 | mActionBeamVCard = 0; |
1946 | mActionBeam = 0; | 1946 | mActionBeam = 0; |
1947 | 1947 | ||
1948 | #ifndef DESKTOP_VERSION | 1948 | #ifndef DESKTOP_VERSION |
1949 | if ( Ir::supported() ) { | 1949 | if ( Ir::supported() ) { |
1950 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 1950 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1951 | SLOT( beamVCard() ), actionCollection(), | 1951 | SLOT( beamVCard() ), actionCollection(), |
1952 | "kaddressbook_beam_vcard" ); | 1952 | "kaddressbook_beam_vcard" ); |
1953 | 1953 | ||
1954 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1954 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1955 | SLOT( beamMySelf() ), actionCollection(), | 1955 | SLOT( beamMySelf() ), actionCollection(), |
1956 | "kaddressbook_beam_myself" ); | 1956 | "kaddressbook_beam_myself" ); |
1957 | } | 1957 | } |
1958 | #endif | 1958 | #endif |
1959 | 1959 | ||
1960 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1960 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1961 | this, SLOT( editContact2() ), | 1961 | this, SLOT( editContact2() ), |
1962 | actionCollection(), "file_properties" ); | 1962 | actionCollection(), "file_properties" ); |
1963 | 1963 | ||
1964 | #ifdef KAB_EMBEDDED | 1964 | #ifdef KAB_EMBEDDED |
1965 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1965 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1966 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1966 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1967 | mMainWindow, SLOT( exit() ), | 1967 | mMainWindow, SLOT( exit() ), |
1968 | actionCollection(), "quit" ); | 1968 | actionCollection(), "quit" ); |
1969 | #endif //KAB_EMBEDDED | 1969 | #endif //KAB_EMBEDDED |
1970 | 1970 | ||
1971 | // edit menu | 1971 | // edit menu |
1972 | if ( mIsPart ) { | 1972 | if ( mIsPart ) { |
1973 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1973 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1974 | SLOT( copyContacts() ), actionCollection(), | 1974 | SLOT( copyContacts() ), actionCollection(), |
1975 | "kaddressbook_copy" ); | 1975 | "kaddressbook_copy" ); |
1976 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1976 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1977 | SLOT( cutContacts() ), actionCollection(), | 1977 | SLOT( cutContacts() ), actionCollection(), |
1978 | "kaddressbook_cut" ); | 1978 | "kaddressbook_cut" ); |
1979 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1979 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1980 | SLOT( pasteContacts() ), actionCollection(), | 1980 | SLOT( pasteContacts() ), actionCollection(), |
1981 | "kaddressbook_paste" ); | 1981 | "kaddressbook_paste" ); |
1982 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1982 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1983 | SLOT( selectAllContacts() ), actionCollection(), | 1983 | SLOT( selectAllContacts() ), actionCollection(), |
1984 | "kaddressbook_select_all" ); | 1984 | "kaddressbook_select_all" ); |
1985 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1985 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1986 | SLOT( undo() ), actionCollection(), | 1986 | SLOT( undo() ), actionCollection(), |
1987 | "kaddressbook_undo" ); | 1987 | "kaddressbook_undo" ); |
1988 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1988 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1989 | this, SLOT( redo() ), actionCollection(), | 1989 | this, SLOT( redo() ), actionCollection(), |
1990 | "kaddressbook_redo" ); | 1990 | "kaddressbook_redo" ); |
1991 | } else { | 1991 | } else { |
1992 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1992 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1993 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1993 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1994 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1994 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1995 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1995 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1996 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1996 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1997 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1997 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 2000 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
2001 | Key_Delete, this, SLOT( deleteContacts() ), | 2001 | Key_Delete, this, SLOT( deleteContacts() ), |
2002 | actionCollection(), "edit_delete" ); | 2002 | actionCollection(), "edit_delete" ); |
2003 | 2003 | ||
2004 | mActionUndo->setEnabled( false ); | 2004 | mActionUndo->setEnabled( false ); |
2005 | mActionRedo->setEnabled( false ); | 2005 | mActionRedo->setEnabled( false ); |
2006 | 2006 | ||
2007 | // settings menu | 2007 | // settings menu |
2008 | #ifdef KAB_EMBEDDED | 2008 | #ifdef KAB_EMBEDDED |
2009 | //US special menuentry to configure the addressbook resources. On KDE | 2009 | //US special menuentry to configure the addressbook resources. On KDE |
2010 | // you do that through the control center !!! | 2010 | // you do that through the control center !!! |
2011 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 2011 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
2012 | SLOT( configureResources() ), actionCollection(), | 2012 | SLOT( configureResources() ), actionCollection(), |
2013 | "kaddressbook_configure_resources" ); | 2013 | "kaddressbook_configure_resources" ); |
2014 | #endif //KAB_EMBEDDED | 2014 | #endif //KAB_EMBEDDED |
2015 | 2015 | ||
2016 | if ( mIsPart ) { | 2016 | if ( mIsPart ) { |
2017 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 2017 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
2018 | SLOT( openConfigDialog() ), actionCollection(), | 2018 | SLOT( openConfigDialog() ), actionCollection(), |
2019 | "kaddressbook_configure" ); | 2019 | "kaddressbook_configure" ); |
2020 | 2020 | ||
2021 | //US not implemented yet | 2021 | //US not implemented yet |
2022 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 2022 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
2023 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 2023 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
2024 | // "kaddressbook_configure_shortcuts" ); | 2024 | // "kaddressbook_configure_shortcuts" ); |
2025 | #ifdef KAB_EMBEDDED | 2025 | #ifdef KAB_EMBEDDED |
2026 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 2026 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
2027 | mActionConfigureToolbars->setEnabled( false ); | 2027 | mActionConfigureToolbars->setEnabled( false ); |
2028 | #endif //KAB_EMBEDDED | 2028 | #endif //KAB_EMBEDDED |
2029 | 2029 | ||
2030 | } else { | 2030 | } else { |
2031 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 2031 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
2032 | 2032 | ||
2033 | //US not implemented yet | 2033 | //US not implemented yet |
2034 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 2034 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
2035 | } | 2035 | } |
2036 | 2036 | ||
2037 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 2037 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
2038 | actionCollection(), "options_show_jump_bar" ); | 2038 | actionCollection(), "options_show_jump_bar" ); |
2039 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); | 2039 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); |
2040 | 2040 | ||
2041 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2041 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
2042 | actionCollection(), "options_show_details" ); | 2042 | actionCollection(), "options_show_details" ); |
2043 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2043 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
2044 | 2044 | ||
2045 | 2045 | ||
2046 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2046 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
2047 | SLOT( toggleBeamReceive() ), actionCollection(), | 2047 | SLOT( toggleBeamReceive() ), actionCollection(), |
2048 | "kaddressbook_beam_rec" ); | 2048 | "kaddressbook_beam_rec" ); |
2049 | 2049 | ||
2050 | 2050 | ||
2051 | // misc | 2051 | // misc |
2052 | // only enable LDAP lookup if we can handle the protocol | 2052 | // only enable LDAP lookup if we can handle the protocol |
2053 | #ifndef KAB_EMBEDDED | 2053 | #ifndef KAB_EMBEDDED |
2054 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2054 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
2055 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2055 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
2056 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2056 | this, SLOT( openLDAPDialog() ), actionCollection(), |
2057 | "ldap_lookup" ); | 2057 | "ldap_lookup" ); |
2058 | } | 2058 | } |
2059 | #else //KAB_EMBEDDED | 2059 | #else //KAB_EMBEDDED |
2060 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2060 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
2061 | #endif //KAB_EMBEDDED | 2061 | #endif //KAB_EMBEDDED |
2062 | 2062 | ||
2063 | 2063 | ||
2064 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2064 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
2065 | SLOT( setWhoAmI() ), actionCollection(), | 2065 | SLOT( setWhoAmI() ), actionCollection(), |
2066 | "set_personal" ); | 2066 | "set_personal" ); |
2067 | 2067 | ||
2068 | 2068 | ||
2069 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, | 2069 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, |
2070 | SLOT( setCategories() ), actionCollection(), | 2070 | SLOT( setCategories() ), actionCollection(), |
2071 | "edit_set_categories" ); | 2071 | "edit_set_categories" ); |
2072 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, | 2072 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, |
2073 | SLOT( editCategories() ), actionCollection(), | 2073 | SLOT( editCategories() ), actionCollection(), |
2074 | "edit__categories" ); | 2074 | "edit__categories" ); |
2075 | 2075 | ||
2076 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2076 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
2077 | SLOT( removeVoice() ), actionCollection(), | 2077 | SLOT( removeVoice() ), actionCollection(), |
2078 | "remove_voice" ); | 2078 | "remove_voice" ); |
2079 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | 2079 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, |
2080 | SLOT( setFormattedName() ), actionCollection(), | 2080 | SLOT( setFormattedName() ), actionCollection(), |
2081 | "set_formatted" ); | 2081 | "set_formatted" ); |
2082 | 2082 | ||
2083 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2083 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2084 | SLOT( manageCategories() ), actionCollection(), | 2084 | SLOT( manageCategories() ), actionCollection(), |
2085 | "remove_voice" ); | 2085 | "remove_voice" ); |
2086 | 2086 | ||
2087 | 2087 | ||
2088 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2088 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2089 | SLOT( importFromOL() ), actionCollection(), | 2089 | SLOT( importFromOL() ), actionCollection(), |
2090 | "import_OL" ); | 2090 | "import_OL" ); |
2091 | #ifdef KAB_EMBEDDED | 2091 | #ifdef KAB_EMBEDDED |
2092 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2092 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2093 | this, SLOT( showLicence() ), actionCollection(), | 2093 | this, SLOT( showLicence() ), actionCollection(), |
2094 | "licence_about_data" ); | 2094 | "licence_about_data" ); |
2095 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2095 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2096 | this, SLOT( faq() ), actionCollection(), | 2096 | this, SLOT( faq() ), actionCollection(), |
2097 | "faq_about_data" ); | 2097 | "faq_about_data" ); |
2098 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2098 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2099 | this, SLOT( whatsnew() ), actionCollection(), | 2099 | this, SLOT( whatsnew() ), actionCollection(), |
2100 | "wn" ); | 2100 | "wn" ); |
2101 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2101 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2102 | this, SLOT( synchowto() ), actionCollection(), | 2102 | this, SLOT( synchowto() ), actionCollection(), |
2103 | "sync" ); | 2103 | "sync" ); |
2104 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2104 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2105 | this, SLOT( kdesynchowto() ), actionCollection(), | 2105 | this, SLOT( kdesynchowto() ), actionCollection(), |
2106 | "kdesync" ); | 2106 | "kdesync" ); |
2107 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2107 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2108 | this, SLOT( multisynchowto() ), actionCollection(), | 2108 | this, SLOT( multisynchowto() ), actionCollection(), |
2109 | "multisync" ); | 2109 | "multisync" ); |
2110 | 2110 | ||
2111 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2111 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2112 | this, SLOT( createAboutData() ), actionCollection(), | 2112 | this, SLOT( createAboutData() ), actionCollection(), |
2113 | "kaddressbook_about_data" ); | 2113 | "kaddressbook_about_data" ); |
2114 | #endif //KAB_EMBEDDED | 2114 | #endif //KAB_EMBEDDED |
2115 | 2115 | ||
2116 | clipboardDataChanged(); | 2116 | clipboardDataChanged(); |
2117 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2117 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2118 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2118 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2119 | } | 2119 | } |
2120 | 2120 | ||
2121 | //US we need this function, to plug all actions into the correct menues. | 2121 | //US we need this function, to plug all actions into the correct menues. |
2122 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2122 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2123 | void KABCore::addActionsManually() | 2123 | void KABCore::addActionsManually() |
2124 | { | 2124 | { |
2125 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2125 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2126 | 2126 | ||
2127 | #ifdef KAB_EMBEDDED | 2127 | #ifdef KAB_EMBEDDED |
2128 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2128 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2129 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2129 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2130 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2130 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2131 | 2131 | ||
2132 | KToolBar* tb = mMainWindow->toolBar(); | 2132 | KToolBar* tb = mMainWindow->toolBar(); |
2133 | 2133 | mMainWindow->setToolBarsMovable (false ); | |
2134 | #ifndef DESKTOP_VERSION | 2134 | #ifndef DESKTOP_VERSION |
2135 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2135 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2136 | #endif | 2136 | #endif |
2137 | QMenuBar* mb = mMainWindow->menuBar(); | 2137 | QMenuBar* mb = mMainWindow->menuBar(); |
2138 | 2138 | ||
2139 | //US setup menubar. | 2139 | //US setup menubar. |
2140 | //Disable the following block if you do not want to have a menubar. | 2140 | //Disable the following block if you do not want to have a menubar. |
2141 | mb->insertItem( i18n("&File"), fileMenu ); | 2141 | mb->insertItem( i18n("&File"), fileMenu ); |
2142 | mb->insertItem( i18n("&Edit"), editMenu ); | 2142 | mb->insertItem( i18n("&Edit"), editMenu ); |
2143 | mb->insertItem( i18n("&View"), viewMenu ); | 2143 | mb->insertItem( i18n("&View"), viewMenu ); |
2144 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2144 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2145 | #ifdef DESKTOP_VERSION | 2145 | #ifdef DESKTOP_VERSION |
2146 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2146 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2147 | #else | 2147 | #else |
2148 | mb->insertItem( i18n("Sync"), syncMenu ); | 2148 | mb->insertItem( i18n("Sync"), syncMenu ); |
2149 | #endif | 2149 | #endif |
2150 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2150 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2151 | mb->insertItem( i18n("&Help"), helpMenu ); | 2151 | mb->insertItem( i18n("&Help"), helpMenu ); |
2152 | mIncSearchWidget = new IncSearchWidget( tb ); | 2152 | mIncSearchWidget = new IncSearchWidget( tb ); |
2153 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2153 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2154 | #ifndef DESKTOP_VERSION | 2154 | #ifndef DESKTOP_VERSION |
2155 | } else { | 2155 | } else { |
2156 | //US setup toolbar | 2156 | //US setup toolbar |
2157 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2157 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2158 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2158 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2159 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); | 2159 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2160 | tb->insertWidget(-1, 0, menuBarTB); | 2160 | tb->insertWidget(-1, 0, menuBarTB); |
2161 | mIncSearchWidget = new IncSearchWidget( tb ); | 2161 | mIncSearchWidget = new IncSearchWidget( tb ); |
2162 | tb->enableMoving(false); | 2162 | tb->enableMoving(false); |
2163 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2163 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2164 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2164 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2165 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2165 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2166 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2166 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2167 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2167 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2168 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2168 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2169 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2169 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2170 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2170 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2171 | if (QApplication::desktop()->width() > 320 ) { | 2171 | if (QApplication::desktop()->width() > 320 ) { |
2172 | // mViewManager->getFilterAction()->plug ( tb); | 2172 | // mViewManager->getFilterAction()->plug ( tb); |
2173 | } | 2173 | } |
2174 | } | 2174 | } |
2175 | #endif | 2175 | #endif |
2176 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2176 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2177 | 2177 | ||
2178 | 2178 | ||
2179 | 2179 | ||
2180 | //US Now connect the actions with the menue entries. | 2180 | //US Now connect the actions with the menue entries. |
2181 | #ifdef DESKTOP_VERSION | 2181 | #ifdef DESKTOP_VERSION |
2182 | mActionPrint->plug( fileMenu ); | 2182 | mActionPrint->plug( fileMenu ); |
2183 | mActionPrintDetails->plug( fileMenu ); | 2183 | mActionPrintDetails->plug( fileMenu ); |
2184 | fileMenu->insertSeparator(); | 2184 | fileMenu->insertSeparator(); |
2185 | #endif | 2185 | #endif |
2186 | mActionMail->plug( fileMenu ); | 2186 | mActionMail->plug( fileMenu ); |
2187 | fileMenu->insertSeparator(); | 2187 | fileMenu->insertSeparator(); |
2188 | 2188 | ||
2189 | mActionNewContact->plug( fileMenu ); | 2189 | mActionNewContact->plug( editMenu ); |
2190 | mActionNewContact->plug( tb ); | 2190 | mActionNewContact->plug( tb ); |
2191 | 2191 | ||
2192 | mActionEditAddressee->plug( fileMenu ); | 2192 | mActionEditAddressee->plug( editMenu ); |
2193 | editMenu->insertSeparator(); | ||
2193 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2194 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2194 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2195 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2195 | mActionEditAddressee->plug( tb ); | 2196 | mActionEditAddressee->plug( tb ); |
2196 | 2197 | ||
2197 | fileMenu->insertSeparator(); | 2198 | // fileMenu->insertSeparator(); |
2198 | mActionSave->plug( fileMenu ); | 2199 | mActionSave->plug( fileMenu ); |
2199 | fileMenu->insertItem( "&Import", ImportMenu ); | 2200 | fileMenu->insertItem( "&Import", ImportMenu ); |
2200 | fileMenu->insertItem( "&Export", ExportMenu ); | 2201 | fileMenu->insertItem( "&Export", ExportMenu ); |
2201 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2202 | editMenu->insertItem( i18n("&Change"), changeMenu ); |
2203 | editMenu->insertSeparator(); | ||
2202 | #ifndef DESKTOP_VERSION | 2204 | #ifndef DESKTOP_VERSION |
2203 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2205 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2204 | #endif | 2206 | #endif |
2205 | #if 0 | 2207 | #if 0 |
2206 | // PENDING fix MailVCard | 2208 | // PENDING fix MailVCard |
2207 | fileMenu->insertSeparator(); | 2209 | fileMenu->insertSeparator(); |
2208 | mActionMailVCard->plug( fileMenu ); | 2210 | mActionMailVCard->plug( fileMenu ); |
2209 | #endif | 2211 | #endif |
2210 | #ifndef DESKTOP_VERSION | 2212 | #ifndef DESKTOP_VERSION |
2211 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2213 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2212 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2214 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2213 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2215 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2214 | #endif | 2216 | #endif |
2215 | fileMenu->insertSeparator(); | 2217 | fileMenu->insertSeparator(); |
2216 | mActionQuit->plug( fileMenu ); | 2218 | mActionQuit->plug( fileMenu ); |
2217 | #ifdef _OL_IMPORT_ | 2219 | #ifdef _OL_IMPORT_ |
2218 | mActionImportOL->plug( ImportMenu ); | 2220 | mActionImportOL->plug( ImportMenu ); |
2219 | #endif | 2221 | #endif |
2220 | // edit menu | 2222 | // edit menu |
2221 | mActionUndo->plug( editMenu ); | 2223 | mActionUndo->plug( editMenu ); |
2222 | mActionRedo->plug( editMenu ); | 2224 | mActionRedo->plug( editMenu ); |
2223 | editMenu->insertSeparator(); | 2225 | editMenu->insertSeparator(); |
2224 | mActionCut->plug( editMenu ); | 2226 | mActionCut->plug( editMenu ); |
2225 | mActionCopy->plug( editMenu ); | 2227 | mActionCopy->plug( editMenu ); |
2226 | mActionPaste->plug( editMenu ); | 2228 | mActionPaste->plug( editMenu ); |
2227 | mActionDelete->plug( editMenu ); | 2229 | mActionDelete->plug( editMenu ); |
2228 | editMenu->insertSeparator(); | 2230 | editMenu->insertSeparator(); |
2229 | mActionSelectAll->plug( editMenu ); | 2231 | mActionSelectAll->plug( editMenu ); |
2230 | 2232 | ||
2231 | mActionSetFormattedName->plug( changeMenu ); | 2233 | mActionSetFormattedName->plug( changeMenu ); |
2232 | mActionRemoveVoice->plug( changeMenu ); | 2234 | mActionRemoveVoice->plug( changeMenu ); |
2233 | // settingsmings menu | 2235 | // settingsmings menu |
2234 | //US special menuentry to configure the addressbook resources. On KDE | 2236 | //US special menuentry to configure the addressbook resources. On KDE |
2235 | // you do that through the control center !!! | 2237 | // you do that through the control center !!! |
2236 | // settingsMenu->insertSeparator(); | 2238 | // settingsMenu->insertSeparator(); |
2237 | 2239 | ||
2238 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); | 2240 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); |
2239 | mActionConfigResources->plug( settingsMenu,1 ); | 2241 | mActionConfigResources->plug( settingsMenu,1 ); |
2240 | settingsMenu->insertSeparator(2); | 2242 | settingsMenu->insertSeparator(2); |
2241 | 2243 | ||
2242 | if ( mIsPart ) { | 2244 | if ( mIsPart ) { |
2243 | //US not implemented yet | 2245 | //US not implemented yet |
2244 | //mActionConfigShortcuts->plug( settingsMenu ); | 2246 | //mActionConfigShortcuts->plug( settingsMenu ); |
2245 | //mActionConfigureToolbars->plug( settingsMenu ); | 2247 | //mActionConfigureToolbars->plug( settingsMenu ); |
2246 | 2248 | ||
2247 | } else { | 2249 | } else { |
2248 | //US not implemented yet | 2250 | //US not implemented yet |
2249 | //mActionKeyBindings->plug( settingsMenu ); | 2251 | //mActionKeyBindings->plug( settingsMenu ); |
2250 | } | 2252 | } |
2251 | 2253 | ||
2252 | settingsMenu->insertSeparator(); | 2254 | mActionEditCategories->plug( settingsMenu ); |
2253 | 2255 | mActionManageCategories->plug( settingsMenu ); | |
2254 | mActionJumpBar->plug( settingsMenu ); | 2256 | mActionJumpBar->plug( viewMenu,0 ); |
2255 | mActionDetails->plug( settingsMenu ); | 2257 | mActionDetails->plug( viewMenu,0 ); |
2256 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2258 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2257 | mActionDetails->plug( tb ); | 2259 | mActionDetails->plug( tb ); |
2258 | settingsMenu->insertSeparator(); | 2260 | settingsMenu->insertSeparator(); |
2259 | #ifndef DESKTOP_VERSION | 2261 | #ifndef DESKTOP_VERSION |
2260 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2262 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2261 | settingsMenu->insertSeparator(); | 2263 | settingsMenu->insertSeparator(); |
2262 | #endif | 2264 | #endif |
2263 | 2265 | ||
2264 | mActionWhoAmI->plug( settingsMenu ); | 2266 | mActionWhoAmI->plug( settingsMenu ); |
2265 | mActionEditCategories->plug( settingsMenu ); | 2267 | //mActionEditCategories->plug( changeMenu ); |
2266 | mActionEditCategories->plug( changeMenu ); | ||
2267 | mActionCategories->plug( changeMenu ); | 2268 | mActionCategories->plug( changeMenu ); |
2268 | mActionManageCategories->plug( changeMenu ); | 2269 | //mActionManageCategories->plug( changeMenu ); |
2269 | 2270 | ||
2270 | mActionCategories->plug( settingsMenu ); | 2271 | //mActionCategories->plug( settingsMenu ); |
2271 | mActionManageCategories->plug( settingsMenu ); | ||
2272 | 2272 | ||
2273 | 2273 | ||
2274 | mActionWN->plug( helpMenu ); | 2274 | mActionWN->plug( helpMenu ); |
2275 | mActionSyncHowto->plug( helpMenu ); | 2275 | mActionSyncHowto->plug( helpMenu ); |
2276 | mActionKdeSyncHowto->plug( helpMenu ); | 2276 | mActionKdeSyncHowto->plug( helpMenu ); |
2277 | mActionMultiSyncHowto->plug( helpMenu ); | 2277 | mActionMultiSyncHowto->plug( helpMenu ); |
2278 | mActionFaq->plug( helpMenu ); | 2278 | mActionFaq->plug( helpMenu ); |
2279 | mActionLicence->plug( helpMenu ); | 2279 | mActionLicence->plug( helpMenu ); |
2280 | mActionAboutKAddressbook->plug( helpMenu ); | 2280 | mActionAboutKAddressbook->plug( helpMenu ); |
2281 | 2281 | ||
2282 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2282 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2283 | 2283 | ||
2284 | mActionSave->plug( tb ); | 2284 | mActionSave->plug( tb ); |
2285 | mViewManager->getFilterAction()->plug ( tb); | 2285 | mViewManager->getFilterAction()->plug ( tb); |
2286 | //LR hide filteraction on started in 480x640 | 2286 | //LR hide filteraction on started in 480x640 |
2287 | if (QApplication::desktop()->width() == 480 ) { | 2287 | if (QApplication::desktop()->width() == 480 ) { |
2288 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2288 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2289 | } | 2289 | } |
2290 | mActionUndo->plug( tb ); | 2290 | mActionUndo->plug( tb ); |
2291 | mActionDelete->plug( tb ); | 2291 | mActionDelete->plug( tb ); |
2292 | mActionRedo->plug( tb ); | 2292 | mActionRedo->plug( tb ); |
2293 | } else { | 2293 | } else { |
2294 | mActionSave->plug( tb ); | 2294 | mActionSave->plug( tb ); |
2295 | tb->enableMoving(false); | 2295 | tb->enableMoving(false); |
2296 | } | 2296 | } |
2297 | //mActionQuit->plug ( tb ); | 2297 | //mActionQuit->plug ( tb ); |
2298 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2298 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2299 | 2299 | ||
2300 | //US link the searchwidget first to this. | 2300 | //US link the searchwidget first to this. |
2301 | // The real linkage to the toolbar happens later. | 2301 | // The real linkage to the toolbar happens later. |
2302 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2302 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2303 | //US tb->insertItem( mIncSearchWidget ); | 2303 | //US tb->insertItem( mIncSearchWidget ); |
2304 | /*US | 2304 | /*US |
2305 | mIncSearchWidget = new IncSearchWidget( tb ); | 2305 | mIncSearchWidget = new IncSearchWidget( tb ); |
2306 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2306 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2307 | SLOT( incrementalSearch( const QString& ) ) ); | 2307 | SLOT( incrementalSearch( const QString& ) ) ); |
2308 | 2308 | ||
2309 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2309 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2310 | 2310 | ||
2311 | //US topLayout->addWidget( mJumpButtonBar ); | 2311 | //US topLayout->addWidget( mJumpButtonBar ); |
2312 | this->layout()->add( mJumpButtonBar ); | 2312 | this->layout()->add( mJumpButtonBar ); |
2313 | */ | 2313 | */ |
2314 | 2314 | ||
2315 | #endif //KAB_EMBEDDED | 2315 | #endif //KAB_EMBEDDED |
2316 | 2316 | ||
2317 | mActionExport2phone->plug( ExportMenu ); | 2317 | mActionExport2phone->plug( ExportMenu ); |
2318 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2318 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2319 | syncManager->fillSyncMenu(); | 2319 | syncManager->fillSyncMenu(); |
2320 | 2320 | ||
2321 | } | 2321 | } |
2322 | void KABCore::showLicence() | 2322 | void KABCore::showLicence() |
2323 | { | 2323 | { |
2324 | KApplication::showLicence(); | 2324 | KApplication::showLicence(); |
2325 | } | 2325 | } |
2326 | 2326 | ||
2327 | void KABCore::manageCategories( ) | 2327 | void KABCore::manageCategories( ) |
2328 | { | 2328 | { |
2329 | KABCatPrefs* cp = new KABCatPrefs(); | 2329 | KABCatPrefs* cp = new KABCatPrefs(); |
2330 | cp->show(); | 2330 | cp->show(); |
2331 | int w =cp->sizeHint().width() ; | 2331 | int w =cp->sizeHint().width() ; |
2332 | int h = cp->sizeHint().height() ; | 2332 | int h = cp->sizeHint().height() ; |
2333 | int dw = QApplication::desktop()->width(); | 2333 | int dw = QApplication::desktop()->width(); |
2334 | int dh = QApplication::desktop()->height(); | 2334 | int dh = QApplication::desktop()->height(); |
2335 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2335 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2336 | if ( !cp->exec() ) { | 2336 | if ( !cp->exec() ) { |
2337 | delete cp; | 2337 | delete cp; |
2338 | return; | 2338 | return; |
2339 | } | 2339 | } |
2340 | int count = 0; | 2340 | int count = 0; |
2341 | int cc = 0; | 2341 | int cc = 0; |
2342 | message( i18n("Please wait, processing categories...")); | 2342 | message( i18n("Please wait, processing categories...")); |
2343 | if ( cp->addCat() ) { | 2343 | if ( cp->addCat() ) { |
2344 | KABC::AddressBook::Iterator it; | 2344 | KABC::AddressBook::Iterator it; |
2345 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2345 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2346 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2346 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2347 | ++cc; | 2347 | ++cc; |
2348 | if ( cc %10 == 0) | 2348 | if ( cc %10 == 0) |
2349 | message(i18n("Processing contact #%1").arg(cc)); | 2349 | message(i18n("Processing contact #%1").arg(cc)); |
2350 | QStringList catIncList = (*it).categories(); | 2350 | QStringList catIncList = (*it).categories(); |
2351 | int i; | 2351 | int i; |
2352 | for( i = 0; i< catIncList.count(); ++i ) { | 2352 | for( i = 0; i< catIncList.count(); ++i ) { |
2353 | if ( !catList.contains (catIncList[i])) { | 2353 | if ( !catList.contains (catIncList[i])) { |
2354 | catList.append( catIncList[i] ); | 2354 | catList.append( catIncList[i] ); |
2355 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2355 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2356 | ++count; | 2356 | ++count; |
2357 | } | 2357 | } |
2358 | } | 2358 | } |
2359 | } | 2359 | } |
2360 | catList.sort(); | 2360 | catList.sort(); |
2361 | KABPrefs::instance()->mCustomCategories = catList; | 2361 | KABPrefs::instance()->mCustomCategories = catList; |
2362 | KABPrefs::instance()->writeConfig(); | 2362 | KABPrefs::instance()->writeConfig(); |
2363 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2363 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2364 | } else { | 2364 | } else { |
2365 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2365 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2366 | QStringList catIncList; | 2366 | QStringList catIncList; |
2367 | QStringList newCatList; | 2367 | QStringList newCatList; |
2368 | KABC::AddressBook::Iterator it; | 2368 | KABC::AddressBook::Iterator it; |
2369 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2369 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2370 | ++cc; | 2370 | ++cc; |
2371 | if ( cc %10 == 0) | 2371 | if ( cc %10 == 0) |
2372 | message(i18n("Processing contact #%1").arg(cc)); | 2372 | message(i18n("Processing contact #%1").arg(cc)); |
2373 | QStringList catIncList = (*it).categories(); | 2373 | QStringList catIncList = (*it).categories(); |
2374 | int i; | 2374 | int i; |
2375 | if ( catIncList.count() ) { | 2375 | if ( catIncList.count() ) { |
2376 | newCatList.clear(); | 2376 | newCatList.clear(); |
2377 | for( i = 0; i< catIncList.count(); ++i ) { | 2377 | for( i = 0; i< catIncList.count(); ++i ) { |
2378 | if ( catList.contains (catIncList[i])) { | 2378 | if ( catList.contains (catIncList[i])) { |
2379 | newCatList.append( catIncList[i] ); | 2379 | newCatList.append( catIncList[i] ); |
2380 | } | 2380 | } |
2381 | } | 2381 | } |
2382 | newCatList.sort(); | 2382 | newCatList.sort(); |
2383 | (*it).setCategories( newCatList ); | 2383 | (*it).setCategories( newCatList ); |
2384 | mAddressBook->insertAddressee( (*it) ); | 2384 | mAddressBook->insertAddressee( (*it) ); |
2385 | } | 2385 | } |
2386 | } | 2386 | } |
2387 | setModified( true ); | 2387 | setModified( true ); |
2388 | mViewManager->refreshView(); | 2388 | mViewManager->refreshView(); |
2389 | message( i18n("Removing categories done!")); | 2389 | message( i18n("Removing categories done!")); |
2390 | } | 2390 | } |
2391 | delete cp; | 2391 | delete cp; |
2392 | } | 2392 | } |
2393 | void KABCore::removeVoice() | 2393 | void KABCore::removeVoice() |
2394 | { | 2394 | { |
2395 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2395 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2396 | return; | 2396 | return; |
2397 | XXPortSelectDialog dlg( this, false, this ); | 2397 | XXPortSelectDialog dlg( this, false, this ); |
2398 | if ( !dlg.exec() ) | 2398 | if ( !dlg.exec() ) |
2399 | return; | 2399 | return; |
2400 | mAddressBook->setUntagged(); | 2400 | mAddressBook->setUntagged(); |
2401 | dlg.tagSelected(); | 2401 | dlg.tagSelected(); |
2402 | message(i18n("Removing voice..."), false ); | 2402 | message(i18n("Removing voice..."), false ); |
2403 | KABC::AddressBook::Iterator it; | 2403 | KABC::AddressBook::Iterator it; |
2404 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2404 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2405 | if ( (*it).tagged() ) { | 2405 | if ( (*it).tagged() ) { |
2406 | (*it).removeVoice(); | 2406 | (*it).removeVoice(); |
2407 | } | 2407 | } |
2408 | } | 2408 | } |
2409 | message(i18n("Refreshing view...") ); | 2409 | message(i18n("Refreshing view...") ); |
2410 | qApp->processEvents(); | 2410 | qApp->processEvents(); |
2411 | mViewManager->refreshView( "" ); | 2411 | mViewManager->refreshView( "" ); |
2412 | Addressee add; | 2412 | Addressee add; |
2413 | mDetails->setAddressee( add ); | 2413 | mDetails->setAddressee( add ); |
2414 | message(i18n("Remove voice completed!") ); | 2414 | message(i18n("Remove voice completed!") ); |
2415 | 2415 | ||
2416 | 2416 | ||
2417 | 2417 | ||
2418 | } | 2418 | } |
2419 | 2419 | ||
2420 | void KABCore::setFormattedName() | 2420 | void KABCore::setFormattedName() |
2421 | { | 2421 | { |
2422 | KABFormatPrefs setpref; | 2422 | KABFormatPrefs setpref; |
2423 | if ( !setpref.exec() ) { | 2423 | if ( !setpref.exec() ) { |
2424 | return; | 2424 | return; |
2425 | } | 2425 | } |
2426 | XXPortSelectDialog dlg( this, false, this ); | 2426 | XXPortSelectDialog dlg( this, false, this ); |
2427 | if ( !dlg.exec() ) | 2427 | if ( !dlg.exec() ) |
2428 | return; | 2428 | return; |
2429 | mAddressBook->setUntagged(); | 2429 | mAddressBook->setUntagged(); |
2430 | dlg.tagSelected(); | 2430 | dlg.tagSelected(); |
2431 | int count = 0; | 2431 | int count = 0; |
2432 | KABC::AddressBook::Iterator it; | 2432 | KABC::AddressBook::Iterator it; |
2433 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2433 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2434 | if ( (*it).tagged() ) { | 2434 | if ( (*it).tagged() ) { |
2435 | ++count; | 2435 | ++count; |
2436 | if ( count %10 == 0 ) | 2436 | if ( count %10 == 0 ) |
2437 | message(i18n("Changing contact #%1").arg( count ) ); | 2437 | message(i18n("Changing contact #%1").arg( count ) ); |
2438 | qApp->processEvents(); | 2438 | qApp->processEvents(); |
2439 | QString fName; | 2439 | QString fName; |
2440 | if ( setpref.simple->isChecked() ) | 2440 | if ( setpref.simple->isChecked() ) |
2441 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2441 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2442 | else if ( setpref.full->isChecked() ) | 2442 | else if ( setpref.full->isChecked() ) |
2443 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2443 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2444 | else if ( setpref.reverse->isChecked() ) | 2444 | else if ( setpref.reverse->isChecked() ) |
2445 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2445 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2446 | else | 2446 | else |
2447 | fName = (*it).organization(); | 2447 | fName = (*it).organization(); |
2448 | if ( setpref.setCompany->isChecked() ) | 2448 | if ( setpref.setCompany->isChecked() ) |
2449 | if ( fName.isEmpty() || fName =="," ) | 2449 | if ( fName.isEmpty() || fName =="," ) |
2450 | fName = (*it).organization(); | 2450 | fName = (*it).organization(); |
2451 | (*it).setFormattedName( fName ); | 2451 | (*it).setFormattedName( fName ); |
2452 | } | 2452 | } |
2453 | } | 2453 | } |
2454 | message(i18n("Refreshing view...") ); | 2454 | message(i18n("Refreshing view...") ); |
2455 | qApp->processEvents(); | 2455 | qApp->processEvents(); |
2456 | mViewManager->refreshView( "" ); | 2456 | mViewManager->refreshView( "" ); |
2457 | Addressee add; | 2457 | Addressee add; |
2458 | mDetails->setAddressee( add ); | 2458 | mDetails->setAddressee( add ); |
2459 | message(i18n("Setting formatted name completed!") ); | 2459 | message(i18n("Setting formatted name completed!") ); |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | void KABCore::clipboardDataChanged() | 2462 | void KABCore::clipboardDataChanged() |
2463 | { | 2463 | { |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index c2b1bb0..86f0f3d 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -531,207 +531,207 @@ void ViewManager::dropped( QDropEvent *e ) | |||
531 | qDebug("ViewManager::dropped() has to be changed!!" ); | 531 | qDebug("ViewManager::dropped() has to be changed!!" ); |
532 | #endif //KAB_EMBEDDED | 532 | #endif //KAB_EMBEDDED |
533 | 533 | ||
534 | } | 534 | } |
535 | 535 | ||
536 | void ViewManager::startDrag() | 536 | void ViewManager::startDrag() |
537 | { | 537 | { |
538 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; | 538 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; |
539 | 539 | ||
540 | #ifndef KAB_EMBEDDED | 540 | #ifndef KAB_EMBEDDED |
541 | 541 | ||
542 | // Get the list of all the selected addressees | 542 | // Get the list of all the selected addressees |
543 | KABC::Addressee::List addrList; | 543 | KABC::Addressee::List addrList; |
544 | QStringList uidList = selectedUids(); | 544 | QStringList uidList = selectedUids(); |
545 | QStringList::Iterator iter; | 545 | QStringList::Iterator iter; |
546 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 546 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
547 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 547 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
548 | 548 | ||
549 | KMultipleDrag *drag = new KMultipleDrag( this ); | 549 | KMultipleDrag *drag = new KMultipleDrag( this ); |
550 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 550 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
551 | KABC::Addressee::List::Iterator it; | 551 | KABC::Addressee::List::Iterator it; |
552 | QStringList vcards; | 552 | QStringList vcards; |
553 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 553 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
554 | QString vcard = QString::null; | 554 | QString vcard = QString::null; |
555 | KABC::VCardConverter converter; | 555 | KABC::VCardConverter converter; |
556 | if ( converter.addresseeToVCard( *it, vcard ) ) | 556 | if ( converter.addresseeToVCard( *it, vcard ) ) |
557 | vcards.append( vcard ); | 557 | vcards.append( vcard ); |
558 | } | 558 | } |
559 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 559 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
560 | 560 | ||
561 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 561 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
562 | drag->dragCopy(); | 562 | drag->dragCopy(); |
563 | 563 | ||
564 | #else //KAB_EMBEDDED | 564 | #else //KAB_EMBEDDED |
565 | qDebug("ViewManager::startDrag() has to be changed!!" ); | 565 | qDebug("ViewManager::startDrag() has to be changed!!" ); |
566 | #endif //KAB_EMBEDDED | 566 | #endif //KAB_EMBEDDED |
567 | 567 | ||
568 | } | 568 | } |
569 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) | 569 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) |
570 | { | 570 | { |
571 | if ( mActiveView ) | 571 | if ( mActiveView ) |
572 | mActiveView->doSearch( s, field ); | 572 | mActiveView->doSearch( s, field ); |
573 | 573 | ||
574 | } | 574 | } |
575 | void ViewManager::setActiveFilter( int index ) | 575 | void ViewManager::setActiveFilter( int index ) |
576 | { | 576 | { |
577 | Filter currentFilter; | 577 | Filter currentFilter; |
578 | 578 | ||
579 | if ( ( index - 1 ) < 0 ) | 579 | if ( ( index - 1 ) < 0 ) |
580 | currentFilter = Filter(); | 580 | currentFilter = Filter(); |
581 | else | 581 | else |
582 | currentFilter = mFilterList[ index - 1 ]; | 582 | currentFilter = mFilterList[ index - 1 ]; |
583 | 583 | ||
584 | // Check if we have a view. Since the filter combo is created before | 584 | // Check if we have a view. Since the filter combo is created before |
585 | // the view, this slot could be called before there is a valid view. | 585 | // the view, this slot could be called before there is a valid view. |
586 | if ( mActiveView ) { | 586 | if ( mActiveView ) { |
587 | mActiveView->setFilter( currentFilter ); | 587 | mActiveView->setFilter( currentFilter ); |
588 | mActiveView->refresh(); | 588 | mActiveView->refresh(); |
589 | emit selected( QString::null ); | 589 | emit selected( QString::null ); |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | void ViewManager::configureFilters() | 593 | void ViewManager::configureFilters() |
594 | { | 594 | { |
595 | FilterDialog dlg( this ); | 595 | FilterDialog dlg( this ); |
596 | 596 | ||
597 | dlg.setFilters( mFilterList ); | 597 | dlg.setFilters( mFilterList ); |
598 | 598 | ||
599 | if ( dlg.exec() ) | 599 | if ( dlg.exec() ) |
600 | mFilterList = dlg.filters(); | 600 | mFilterList = dlg.filters(); |
601 | 601 | ||
602 | uint pos = mActionSelectFilter->currentItem(); | 602 | uint pos = mActionSelectFilter->currentItem(); |
603 | mActionSelectFilter->setItems( filterNames() ); | 603 | mActionSelectFilter->setItems( filterNames() ); |
604 | mActionSelectFilter->setCurrentItem( pos ); | 604 | mActionSelectFilter->setCurrentItem( pos ); |
605 | setActiveFilter( pos ); | 605 | setActiveFilter( pos ); |
606 | int cw = 150; | 606 | int cw = 150; |
607 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) | 607 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
608 | cw = 0; | 608 | cw = 0; |
609 | mActionSelectFilter->setComboWidth( cw ); | 609 | mActionSelectFilter->setComboWidth( cw ); |
610 | saveSettings(); | 610 | saveSettings(); |
611 | } | 611 | } |
612 | 612 | ||
613 | QStringList ViewManager::filterNames() const | 613 | QStringList ViewManager::filterNames() const |
614 | { | 614 | { |
615 | QStringList names( i18n( "No Filter" ) ); | 615 | QStringList names( i18n( "No Filter" ) ); |
616 | 616 | ||
617 | Filter::List::ConstIterator it; | 617 | Filter::List::ConstIterator it; |
618 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 618 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
619 | names.append( (*it).name() ); | 619 | names.append( (*it).name() ); |
620 | 620 | ||
621 | return names; | 621 | return names; |
622 | } | 622 | } |
623 | Filter ViewManager::getFilterByName( const QString &name ) const | 623 | Filter ViewManager::getFilterByName( const QString &name ) const |
624 | { | 624 | { |
625 | Filter::List::ConstIterator it; | 625 | Filter::List::ConstIterator it; |
626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
627 | if ( name == (*it).name() ) | 627 | if ( name == (*it).name() ) |
628 | return (*it); | 628 | return (*it); |
629 | 629 | ||
630 | return Filter(); | 630 | return Filter(); |
631 | } | 631 | } |
632 | 632 | ||
633 | int ViewManager::filterPosition( const QString &name ) const | 633 | int ViewManager::filterPosition( const QString &name ) const |
634 | { | 634 | { |
635 | int pos = 0; | 635 | int pos = 0; |
636 | 636 | ||
637 | Filter::List::ConstIterator it; | 637 | Filter::List::ConstIterator it; |
638 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 638 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
639 | if ( name == (*it).name() ) | 639 | if ( name == (*it).name() ) |
640 | return pos + 1; | 640 | return pos + 1; |
641 | 641 | ||
642 | return 0; | 642 | return 0; |
643 | } | 643 | } |
644 | 644 | ||
645 | void ViewManager::initActions() | 645 | void ViewManager::initActions() |
646 | { | 646 | { |
647 | //US <ActionList name="view_loadedviews"/> | 647 | //US <ActionList name="view_loadedviews"/> |
648 | //US <Separator/> | 648 | //US <Separator/> |
649 | 649 | ||
650 | #ifdef KAB_EMBEDDED | 650 | #ifdef KAB_EMBEDDED |
651 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 651 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
652 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 652 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
653 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 653 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
654 | #endif //KAB_EMBEDDED | 654 | #endif //KAB_EMBEDDED |
655 | 655 | ||
656 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 656 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
657 | #if KDE_VERSION >= 309 | 657 | #if KDE_VERSION >= 309 |
658 | mActionSelectView->setMenuAccelsEnabled( false ); | 658 | mActionSelectView->setMenuAccelsEnabled( false ); |
659 | #endif | 659 | #endif |
660 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 660 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
661 | SLOT( selectView( const QString& ) ) ); | 661 | SLOT( selectView( const QString& ) ) ); |
662 | 662 | ||
663 | 663 | ||
664 | #ifdef KAB_EMBEDDED | 664 | #ifdef KAB_EMBEDDED |
665 | mActionSelectView->plug(viewmenu); | 665 | mActionSelectView->plug(viewmenu); |
666 | viewmenu->insertSeparator(); | 666 | viewmenu->insertSeparator(); |
667 | #endif //KAB_EMBEDDED | 667 | #endif //KAB_EMBEDDED |
668 | 668 | ||
669 | KAction *action; | 669 | KAction *action; |
670 | 670 | ||
671 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 671 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
672 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 672 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
673 | #ifndef KAB_EMBEDDED | 673 | #ifndef KAB_EMBEDDED |
674 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); | 674 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); |
675 | #else //KAB_EMBEDDED | 675 | #else //KAB_EMBEDDED |
676 | action->plug(viewmenu); | 676 | action->plug(viewmenu); |
677 | #endif //KAB_EMBEDDED | 677 | #endif //KAB_EMBEDDED |
678 | 678 | ||
679 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, | 679 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, |
680 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); | 680 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); |
681 | #ifndef KAB_EMBEDDED | 681 | #ifndef KAB_EMBEDDED |
682 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); | 682 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); |
683 | #else //KAB_EMBEDDED | 683 | #else //KAB_EMBEDDED |
684 | action->plug(viewmenu); | 684 | action->plug(viewmenu); |
685 | #endif //KAB_EMBEDDED | 685 | #endif //KAB_EMBEDDED |
686 | 686 | ||
687 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, | 687 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, |
688 | this, SLOT( deleteView() ), | 688 | this, SLOT( deleteView() ), |
689 | mCore->actionCollection(), "view_delete" ); | 689 | mCore->actionCollection(), "view_delete" ); |
690 | #ifndef KAB_EMBEDDED | 690 | #ifndef KAB_EMBEDDED |
691 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); | 691 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); |
692 | #else //KAB_EMBEDDED | 692 | #else //KAB_EMBEDDED |
693 | mActionDeleteView->plug(viewmenu); | 693 | mActionDeleteView->plug(viewmenu); |
694 | viewmenu->insertSeparator(); | 694 | viewmenu->insertSeparator(); |
695 | #endif //KAB_EMBEDDED | 695 | #endif //KAB_EMBEDDED |
696 | 696 | ||
697 | #ifndef KAB_EMBEDDED | 697 | #ifndef KAB_EMBEDDED |
698 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 698 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
699 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), | 699 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), |
700 | "view_refresh" ); | 700 | "view_refresh" ); |
701 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); | 701 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); |
702 | #else //KAB_EMBEDDED | 702 | #else //KAB_EMBEDDED |
703 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 703 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
704 | SLOT( refreshView()), mCore->actionCollection(), | 704 | SLOT( refreshView()), mCore->actionCollection(), |
705 | "view_refresh" ); | 705 | "view_refresh" ); |
706 | action->plug(viewmenu); | 706 | action->plug(viewmenu); |
707 | viewmenu->insertSeparator(); | 707 | viewmenu->insertSeparator(); |
708 | #endif //KAB_EMBEDDED | 708 | #endif //KAB_EMBEDDED |
709 | 709 | ||
710 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, | 710 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, |
711 | SLOT( configureFilters() ), mCore->actionCollection(), | 711 | SLOT( configureFilters() ), mCore->actionCollection(), |
712 | "options_edit_filters" ); | 712 | "options_edit_filters" ); |
713 | 713 | ||
714 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); | 714 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); |
715 | #if KDE_VERSION >= 309 | 715 | #if KDE_VERSION >= 309 |
716 | mActionSelectFilter->setMenuAccelsEnabled( false ); | 716 | mActionSelectFilter->setMenuAccelsEnabled( false ); |
717 | #endif | 717 | #endif |
718 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), | 718 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), |
719 | SLOT( setActiveFilter( int ) ) ); | 719 | SLOT( setActiveFilter( int ) ) ); |
720 | 720 | ||
721 | #ifdef KAB_EMBEDDED | 721 | #ifdef KAB_EMBEDDED |
722 | action->plug(settingsmenu); | 722 | action->plug(settingsmenu); |
723 | mActionSelectFilter->plug(viewmenu); | 723 | mActionSelectFilter->plug(viewmenu,0); |
724 | #endif //KAB_EMBEDDED | 724 | #endif //KAB_EMBEDDED |
725 | 725 | ||
726 | } | 726 | } |
727 | 727 | ||
728 | void ViewManager::initGUI() | 728 | void ViewManager::initGUI() |
729 | { | 729 | { |
730 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); | 730 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); |
731 | mViewWidgetStack = new QWidgetStack( this ); | 731 | mViewWidgetStack = new QWidgetStack( this ); |
732 | layout->addWidget( mViewWidgetStack ); | 732 | layout->addWidget( mViewWidgetStack ); |
733 | } | 733 | } |
734 | 734 | ||
735 | #ifndef KAB_EMBEDDED | 735 | #ifndef KAB_EMBEDDED |
736 | #include "viewmanager.moc" | 736 | #include "viewmanager.moc" |
737 | #endif //KAB_EMBEDDED | 737 | #endif //KAB_EMBEDDED |