summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-11 19:22:09 (UTC)
committer ulf69 <ulf69>2004-08-11 19:22:09 (UTC)
commit34681e7392fbed71cc48f615b5cd88614a581396 (patch) (unidiff)
treed2265acfba7dd6362565762c70621a9de0595244
parentf79407b018b3abd9a99ccd259f1ff24f3bfee6a4 (diff)
downloadkdepimpi-34681e7392fbed71cc48f615b5cd88614a581396.zip
kdepimpi-34681e7392fbed71cc48f615b5cd88614a581396.tar.gz
kdepimpi-34681e7392fbed71cc48f615b5cd88614a581396.tar.bz2
added functionality to support the multiple view config setting
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp138
-rw-r--r--kaddressbook/kabcore.h7
2 files changed, 100 insertions, 45 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 96603e6..6807bed 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -190,15 +190,6 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
190 connect( mViewManager, SIGNAL( selected( const QString& ) ), 190 connect( mViewManager, SIGNAL( selected( const QString& ) ),
191 SLOT( setContactSelected( const QString& ) ) ); 191 SLOT( setContactSelected( const QString& ) ) );
192 192 connect( mViewManager, SIGNAL( executed( const QString& ) ),
193 //small devices show only the details view. bigger devices can edit the entry 193 SLOT( executeContact( const QString& ) ) );
194 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
195 connect( mViewManager, SIGNAL( executed( const QString& ) ),
196 SLOT( editContact( const QString& ) ) );
197 }
198 else
199 {
200 connect( mViewManager, SIGNAL( executed( const QString& ) ),
201 SLOT( showContact( const QString& ) ) );
202 }
203 194
204 connect( mViewManager, SIGNAL( deleteRequest( ) ), 195 connect( mViewManager, SIGNAL( deleteRequest( ) ),
@@ -208,4 +199,5 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
208 199
209 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 200 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
201 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
210 202
211 connect( mXXPortManager, SIGNAL( modified() ), 203 connect( mXXPortManager, SIGNAL( modified() ),
@@ -247,8 +239,9 @@ KABCore::~KABCore()
247void KABCore::restoreSettings() 239void KABCore::restoreSettings()
248{ 240{
241 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
242
249 bool state; 243 bool state;
250 244
251 //small devices have at startup the details view disabled 245 if (mMultipleViewsAtOnce)
252 if (KGlobal::getDesktopSize() > KGlobal::Small )
253 state = KABPrefs::instance()->mDetailsPageVisible; 246 state = KABPrefs::instance()->mDetailsPageVisible;
254 else 247 else
@@ -262,5 +255,5 @@ void KABCore::restoreSettings()
262 mActionJumpBar->setChecked( state ); 255 mActionJumpBar->setChecked( state );
263 setJumpButtonBarVisible( state ); 256 setJumpButtonBarVisible( state );
264 257/*US
265 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 258 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
266 if ( splitterSize.count() == 0 ) { 259 if ( splitterSize.count() == 0 ) {
@@ -278,26 +271,26 @@ void KABCore::restoreSettings()
278 271
279 } 272 }
280#ifndef KAB_EMBEDDED 273*/
281 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 274 mViewManager->restoreSettings();
275 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
276 mExtensionManager->restoreSettings();
277
278 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
282 if ( splitterSize.count() == 0 ) { 279 if ( splitterSize.count() == 0 ) {
283 splitterSize.append( width() / 2 ); 280 splitterSize.append( width() / 2 );
284 splitterSize.append( width() / 2 ); 281 splitterSize.append( width() / 2 );
285 } 282 }
286 mExtensionBarSplitter->setSizes( splitterSize ); 283 mMiniSplitter->setSizes( splitterSize );
287 284 if ( mExtensionBarSplitter ) {
288 splitterSize = KABPrefs::instance()->mDetailsSplitter; 285 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
289 if ( splitterSize.count() == 0 ) { 286 if ( splitterSize.count() == 0 ) {
290 splitterSize.append( height() / 2 ); 287 splitterSize.append( width() / 2 );
291 splitterSize.append( height() / 2 ); 288 splitterSize.append( width() / 2 );
292 } 289 }
293 mDetailsSplitter->setSizes( splitterSize ); 290 mExtensionBarSplitter->setSizes( splitterSize );
294 291
295 mExtensionManager->restoreSettings(); 292 }
296 293
297#endif //KAB_EMBEDDED
298 294
299 mViewManager->restoreSettings();
300 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
301 mExtensionManager->restoreSettings();
302} 295}
303 296
@@ -431,5 +424,5 @@ void KABCore::setContactSelected( const QString &uid )
431{ 424{
432 KABC::Addressee addr = mAddressBook->findByUid( uid ); 425 KABC::Addressee addr = mAddressBook->findByUid( uid );
433//US if ( !mDetails->isHidden() ) 426 if ( !mDetails->isHidden() )
434 mDetails->setAddressee( addr ); 427 mDetails->setAddressee( addr );
435 428
@@ -1058,12 +1051,19 @@ void KABCore::editContact( const QString &uid )
1058 1051
1059/** 1052/**
1060 Shows the detail view for the given uid. If the uid is QString::null, 1053 Shows or edits the detail view for the given uid. If the uid is QString::null,
1061 the method will try to find a selected addressee in the view. 1054 the method will try to find a selected addressee in the view.
1062 We call this method only if we use a small device. Bigger devices are calling editContact instead
1063 */ 1055 */
1064void KABCore::showContact( const QString &uid /*US = QString::null*/ ) 1056void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1065{ 1057{
1066 setDetailsVisible( true ); 1058 if ( mMultipleViewsAtOnce )
1067 mActionDetails->setChecked(true); 1059 {
1060 editContact( uid );
1061 }
1062 else
1063 {
1064 setDetailsVisible( true );
1065 mActionDetails->setChecked(true);
1066 }
1067
1068} 1068}
1069 1069
@@ -1115,5 +1115,6 @@ void KABCore::redo()
1115void KABCore::setJumpButtonBarVisible( bool visible ) 1115void KABCore::setJumpButtonBarVisible( bool visible )
1116{ 1116{
1117 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1117 if (mMultipleViewsAtOnce)
1118 {
1118 if ( visible ) 1119 if ( visible )
1119 mJumpButtonBar->show(); 1120 mJumpButtonBar->show();
@@ -1123,5 +1124,5 @@ void KABCore::setJumpButtonBarVisible( bool visible )
1123 else 1124 else
1124 { 1125 {
1125 // for the Z5500, show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1126 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1126 if (mViewManager->isVisible()) 1127 if (mViewManager->isVisible())
1127 { 1128 {
@@ -1137,4 +1138,6 @@ void KABCore::setJumpButtonBarVisible( bool visible )
1137 } 1138 }
1138} 1139}
1140
1141
1139void KABCore::setDetailsToState() 1142void KABCore::setDetailsToState()
1140{ 1143{
@@ -1146,10 +1149,15 @@ void KABCore::setDetailsToState()
1146void KABCore::setDetailsVisible( bool visible ) 1149void KABCore::setDetailsVisible( bool visible )
1147{ 1150{
1148 //US "details visible" has two different meanings for small devices like the 5500 1151 if (visible && mDetails->isHidden())
1149 // compared with large devices like the c series. 1152 {
1153 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1154 if ( addrList.count() > 0 )
1155 mDetails->setAddressee( addrList[ 0 ] );
1156 }
1150 1157
1151 // small devices: mDetails is always visible. But we switch between 1158 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1152 // the listview and the detailview. We do that by changing the splitbar size. 1159 // the listview and the detailview. We do that by changing the splitbar size.
1153 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1160 if (mMultipleViewsAtOnce)
1161 {
1154 if ( visible ) 1162 if ( visible )
1155 mDetails->show(); 1163 mDetails->show();
@@ -1162,5 +1170,4 @@ void KABCore::setDetailsVisible( bool visible )
1162 mViewManager->hide(); 1170 mViewManager->hide();
1163 mDetails->show(); 1171 mDetails->show();
1164// mDetails->show();
1165 } 1172 }
1166 else { 1173 else {
@@ -1169,8 +1176,50 @@ void KABCore::setDetailsVisible( bool visible )
1169 } 1176 }
1170 setJumpButtonBarVisible( !visible ); 1177 setJumpButtonBarVisible( !visible );
1178 }
1179
1180}
1181
1182void KABCore::extensionChanged( int id )
1183{
1184 //change the details view only for non desktop systems
1185#ifndef DESKTOP_VERSION
1186
1187 if (id == 0)
1188 {
1189 //the user disabled the extension.
1190
1191 if (mMultipleViewsAtOnce)
1192 { // enable detailsview again
1193 setDetailsVisible( true );
1194 mActionDetails->setChecked( true );
1195 }
1196 else
1197 { //go back to the listview
1198 setDetailsVisible( false );
1199 mActionDetails->setChecked( false );
1200 mActionDetails->setEnabled(true);
1201 }
1171 1202
1172 } 1203 }
1204 else
1205 {
1206 //the user enabled the extension.
1207 setDetailsVisible( false );
1208 mActionDetails->setChecked( false );
1209
1210 if (!mMultipleViewsAtOnce)
1211 {
1212 mActionDetails->setEnabled(false);
1213 }
1214
1215 mExtensionManager->setSelectionChanged();
1216
1217 }
1218
1219#endif// DESKTOP_VERSION
1220
1173} 1221}
1174 1222
1223
1175void KABCore::extensionModified( const KABC::Addressee::List &list ) 1224void KABCore::extensionModified( const KABC::Addressee::List &list )
1176{ 1225{
@@ -1245,5 +1294,5 @@ void KABCore::openConfigDialog()
1245 ConfigureDialog->showMaximized(); 1294 ConfigureDialog->showMaximized();
1246 if ( ConfigureDialog->exec() ) 1295 if ( ConfigureDialog->exec() )
1247 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1296 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1248 delete ConfigureDialog; 1297 delete ConfigureDialog;
1249} 1298}
@@ -1746,5 +1795,8 @@ void KABCore::addActionsManually()
1746 1795
1747 mActionEditAddressee->plug( fileMenu ); 1796 mActionEditAddressee->plug( fileMenu );
1748 mActionEditAddressee->plug( tb ); 1797 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1798 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1799 mActionEditAddressee->plug( tb );
1800
1749 fileMenu->insertSeparator(); 1801 fileMenu->insertSeparator();
1750 mActionSave->plug( fileMenu ); 1802 mActionSave->plug( fileMenu );
@@ -1794,5 +1846,5 @@ void KABCore::addActionsManually()
1794 mActionJumpBar->plug( settingsMenu ); 1846 mActionJumpBar->plug( settingsMenu );
1795 mActionDetails->plug( settingsMenu ); 1847 mActionDetails->plug( settingsMenu );
1796 if (KGlobal::getDesktopSize() == KGlobal::Small ) 1848 if (!KABPrefs::instance()->mMultipleViewsAtOnce )
1797 mActionDetails->plug( tb ); 1849 mActionDetails->plug( tb );
1798 settingsMenu->insertSeparator(); 1850 settingsMenu->insertSeparator();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index a45c4c6..d4d28f1 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -303,8 +303,8 @@ class KABCore : public QWidget
303 303
304 /** 304 /**
305 Shows the detail view for the given uid. If the uid is QString::null, 305 Shows or edits the detail view for the given uid. If the uid is QString::null,
306 the method will try to find a selected addressee in the view. 306 the method will try to find a selected addressee in the view.
307 */ 307 */
308 void showContact( const QString &uid /*US = QString::null*/ ); 308 void executeContact( const QString &uid /*US = QString::null*/ );
309 309
310 /** 310 /**
@@ -339,4 +339,5 @@ class KABCore : public QWidget
339 void importFromOL(); 339 void importFromOL();
340 void extensionModified( const KABC::Addressee::List &list ); 340 void extensionModified( const KABC::Addressee::List &list );
341 void extensionChanged( int id );
341 void clipboardDataChanged(); 342 void clipboardDataChanged();
342 void updateActionMenu(); 343 void updateActionMenu();
@@ -382,4 +383,6 @@ class KABCore : public QWidget
382 bool mModified; 383 bool mModified;
383 bool mIsPart; 384 bool mIsPart;
385 bool mMultipleViewsAtOnce;
386
384 387
385 //US file menu 388 //US file menu