summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp130
-rw-r--r--kaddressbook/kabcore.h7
2 files changed, 96 insertions, 41 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 96603e6..6807bed 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -191,13 +191,4 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
SLOT( setContactSelected( const QString& ) ) );
-
- //small devices show only the details view. bigger devices can edit the entry
- if (KGlobal::getDesktopSize() > KGlobal::Small ) {
- connect( mViewManager, SIGNAL( executed( const QString& ) ),
- SLOT( editContact( const QString& ) ) );
- }
- else
- {
connect( mViewManager, SIGNAL( executed( const QString& ) ),
- SLOT( showContact( const QString& ) ) );
- }
+ SLOT( executeContact( const QString& ) ) );
@@ -209,2 +200,3 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
+ connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
@@ -248,6 +240,7 @@ void KABCore::restoreSettings()
{
+ mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
+
bool state;
- //small devices have at startup the details view disabled
- if (KGlobal::getDesktopSize() > KGlobal::Small )
+ if (mMultipleViewsAtOnce)
state = KABPrefs::instance()->mDetailsPageVisible;
@@ -263,3 +256,3 @@ void KABCore::restoreSettings()
setJumpButtonBarVisible( state );
-
+/*US
QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
@@ -279,4 +272,8 @@ void KABCore::restoreSettings()
}
-#ifndef KAB_EMBEDDED
- QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
+*/
+ mViewManager->restoreSettings();
+ mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
+ mExtensionManager->restoreSettings();
+
+ QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
if ( splitterSize.count() == 0 ) {
@@ -285,18 +282,14 @@ void KABCore::restoreSettings()
}
- mExtensionBarSplitter->setSizes( splitterSize );
-
- splitterSize = KABPrefs::instance()->mDetailsSplitter;
+ mMiniSplitter->setSizes( splitterSize );
+ if ( mExtensionBarSplitter ) {
+ splitterSize = KABPrefs::instance()->mExtensionsSplitter;
if ( splitterSize.count() == 0 ) {
- splitterSize.append( height() / 2 );
- splitterSize.append( height() / 2 );
+ splitterSize.append( width() / 2 );
+ splitterSize.append( width() / 2 );
}
- mDetailsSplitter->setSizes( splitterSize );
+ mExtensionBarSplitter->setSizes( splitterSize );
- mExtensionManager->restoreSettings();
+ }
-#endif //KAB_EMBEDDED
- mViewManager->restoreSettings();
- mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
- mExtensionManager->restoreSettings();
}
@@ -432,3 +425,3 @@ void KABCore::setContactSelected( const QString &uid )
KABC::Addressee addr = mAddressBook->findByUid( uid );
-//US if ( !mDetails->isHidden() )
+ if ( !mDetails->isHidden() )
mDetails->setAddressee( addr );
@@ -1059,7 +1052,12 @@ void KABCore::editContact( const QString &uid )
/**
- Shows the detail view for the given uid. If the uid is QString::null,
+ Shows or edits the detail view for the given uid. If the uid is QString::null,
the method will try to find a selected addressee in the view.
- We call this method only if we use a small device. Bigger devices are calling editContact instead
*/
-void KABCore::showContact( const QString &uid /*US = QString::null*/ )
+void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
+{
+ if ( mMultipleViewsAtOnce )
+ {
+ editContact( uid );
+ }
+ else
{
@@ -1069,2 +1067,4 @@ void KABCore::showContact( const QString &uid /*US = QString::null*/ )
+}
+
void KABCore::save()
@@ -1116,3 +1116,4 @@ void KABCore::setJumpButtonBarVisible( bool visible )
{
- if (KGlobal::getDesktopSize() > KGlobal::Small ) {
+ if (mMultipleViewsAtOnce)
+ {
if ( visible )
@@ -1124,3 +1125,3 @@ void KABCore::setJumpButtonBarVisible( bool visible )
{
- // for the Z5500, show the jumpbar only if "the details are hidden" == "viewmanager are shown"
+ // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
if (mViewManager->isVisible())
@@ -1138,2 +1139,4 @@ void KABCore::setJumpButtonBarVisible( bool visible )
}
+
+
void KABCore::setDetailsToState()
@@ -1147,8 +1150,13 @@ void KABCore::setDetailsVisible( bool visible )
{
- //US "details visible" has two different meanings for small devices like the 5500
- // compared with large devices like the c series.
+ if (visible && mDetails->isHidden())
+ {
+ KABC::Addressee::List addrList = mViewManager->selectedAddressees();
+ if ( addrList.count() > 0 )
+ mDetails->setAddressee( addrList[ 0 ] );
+ }
- // small devices: mDetails is always visible. But we switch between
+ // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
// the listview and the detailview. We do that by changing the splitbar size.
- if (KGlobal::getDesktopSize() > KGlobal::Small ) {
+ if (mMultipleViewsAtOnce)
+ {
if ( visible )
@@ -1163,3 +1171,2 @@ void KABCore::setDetailsVisible( bool visible )
mDetails->show();
-// mDetails->show();
}
@@ -1170,6 +1177,48 @@ void KABCore::setDetailsVisible( bool visible )
setJumpButtonBarVisible( !visible );
+ }
+
+}
+
+void KABCore::extensionChanged( int id )
+{
+ //change the details view only for non desktop systems
+#ifndef DESKTOP_VERSION
+
+ if (id == 0)
+ {
+ //the user disabled the extension.
+
+ if (mMultipleViewsAtOnce)
+ { // enable detailsview again
+ setDetailsVisible( true );
+ mActionDetails->setChecked( true );
+ }
+ else
+ { //go back to the listview
+ setDetailsVisible( false );
+ mActionDetails->setChecked( false );
+ mActionDetails->setEnabled(true);
+ }
+
+ }
+ else
+ {
+ //the user enabled the extension.
+ setDetailsVisible( false );
+ mActionDetails->setChecked( false );
+ if (!mMultipleViewsAtOnce)
+ {
+ mActionDetails->setEnabled(false);
}
+
+ mExtensionManager->setSelectionChanged();
+
}
+#endif// DESKTOP_VERSION
+
+}
+
+
void KABCore::extensionModified( const KABC::Addressee::List &list )
@@ -1246,3 +1295,3 @@ void KABCore::openConfigDialog()
if ( ConfigureDialog->exec() )
- KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
+ KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
delete ConfigureDialog;
@@ -1747,3 +1796,6 @@ void KABCore::addActionsManually()
mActionEditAddressee->plug( fileMenu );
+ if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
+ (!KABPrefs::instance()->mMultipleViewsAtOnce ))
mActionEditAddressee->plug( tb );
+
fileMenu->insertSeparator();
@@ -1795,3 +1847,3 @@ void KABCore::addActionsManually()
mActionDetails->plug( settingsMenu );
- if (KGlobal::getDesktopSize() == KGlobal::Small )
+ if (!KABPrefs::instance()->mMultipleViewsAtOnce )
mActionDetails->plug( tb );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index a45c4c6..d4d28f1 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -304,6 +304,6 @@ class KABCore : public QWidget
/**
- Shows the detail view for the given uid. If the uid is QString::null,
+ Shows or edits the detail view for the given uid. If the uid is QString::null,
the method will try to find a selected addressee in the view.
*/
- void showContact( const QString &uid /*US = QString::null*/ );
+ void executeContact( const QString &uid /*US = QString::null*/ );
@@ -340,2 +340,3 @@ class KABCore : public QWidget
void extensionModified( const KABC::Addressee::List &list );
+ void extensionChanged( int id );
void clipboardDataChanged();
@@ -383,2 +384,4 @@ class KABCore : public QWidget
bool mIsPart;
+ bool mMultipleViewsAtOnce;
+