summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-11 01:57:44 (UTC)
committer ulf69 <ulf69>2004-08-11 01:57:44 (UTC)
commit4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1 (patch) (side-by-side diff)
treec582e58964a01157962c2c9b605bc501ddbe2771
parent42860986468bb90c55783fcebc1b20bd3ee460ac (diff)
downloadkdepimpi-4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1.zip
kdepimpi-4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1.tar.gz
kdepimpi-4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1.tar.bz2
added special detailview handling for small devices. Now the behavior is
a little bit similar to qtopia and opie addressbook
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp108
-rw-r--r--kaddressbook/kabcore.h6
2 files changed, 94 insertions, 20 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 6610288..96603e6 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -191,4 +191,14 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
SLOT( setContactSelected( const QString& ) ) );
- connect( mViewManager, SIGNAL( executed( 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& ) ) );
+ }
+
connect( mViewManager, SIGNAL( deleteRequest( ) ),
@@ -238,8 +248,9 @@ void KABCore::restoreSettings()
{
- bool state = KABPrefs::instance()->mJumpButtonBarVisible;
+ bool state;
- mActionJumpBar->setChecked( state );
- setJumpButtonBarVisible( state );
-
- state = KABPrefs::instance()->mDetailsPageVisible;
+ //small devices have at startup the details view disabled
+ if (KGlobal::getDesktopSize() > KGlobal::Small )
+ state = KABPrefs::instance()->mDetailsPageVisible;
+ else
+ state = false;
@@ -247,2 +258,8 @@ void KABCore::restoreSettings()
setDetailsVisible( state );
+
+ state = KABPrefs::instance()->mJumpButtonBarVisible;
+
+ mActionJumpBar->setChecked( state );
+ setJumpButtonBarVisible( state );
+
QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
@@ -281,5 +298,4 @@ void KABCore::restoreSettings()
- mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
-
mViewManager->restoreSettings();
+ mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
mExtensionManager->restoreSettings();
@@ -303,3 +319,2 @@ void KABCore::saveSettings()
KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
-
}
@@ -417,3 +432,3 @@ void KABCore::setContactSelected( const QString &uid )
KABC::Addressee addr = mAddressBook->findByUid( uid );
- if ( !mDetails->isHidden() )
+//US if ( !mDetails->isHidden() )
mDetails->setAddressee( addr );
@@ -1043,2 +1058,13 @@ void KABCore::editContact( const QString &uid )
+/**
+ Shows 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*/ )
+{
+ setDetailsVisible( true );
+ mActionDetails->setChecked(true);
+}
+
void KABCore::save()
@@ -1090,6 +1116,23 @@ void KABCore::setJumpButtonBarVisible( bool visible )
{
- if ( visible )
- mJumpButtonBar->show();
+ if (KGlobal::getDesktopSize() > KGlobal::Small ) {
+ if ( visible )
+ mJumpButtonBar->show();
+ else
+ mJumpButtonBar->hide();
+ }
else
- mJumpButtonBar->hide();
+ {
+ // for the Z5500, show the jumpbar only if "the details are hidden" == "viewmanager are shown"
+ if (mViewManager->isVisible())
+ {
+ if ( visible )
+ mJumpButtonBar->show();
+ else
+ mJumpButtonBar->hide();
+ }
+ else
+ {
+ mJumpButtonBar->hide();
+ }
+ }
}
@@ -1100,8 +1143,31 @@ void KABCore::setDetailsToState()
+
+
void KABCore::setDetailsVisible( bool visible )
{
- if ( visible )
- mDetails->show();
+ //US "details visible" has two different meanings for small devices like the 5500
+ // compared with large devices like the c series.
+
+ // small devices: 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 ( visible )
+ mDetails->show();
+ else
+ mDetails->hide();
+ }
else
- mDetails->hide();
+ {
+ if ( visible ) {
+ mViewManager->hide();
+ mDetails->show();
+// mDetails->show();
+ }
+ else {
+ mViewManager->show();
+ mDetails->hide();
+ }
+ setJumpButtonBarVisible( !visible );
+
+ }
}
@@ -1573,3 +1639,3 @@ void KABCore::initActions()
- mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
+ mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
actionCollection(), "options_show_details" );
@@ -1681,2 +1747,3 @@ void KABCore::addActionsManually()
mActionEditAddressee->plug( fileMenu );
+ mActionEditAddressee->plug( tb );
fileMenu->insertSeparator();
@@ -1728,2 +1795,4 @@ void KABCore::addActionsManually()
mActionDetails->plug( settingsMenu );
+ if (KGlobal::getDesktopSize() == KGlobal::Small )
+ mActionDetails->plug( tb );
settingsMenu->insertSeparator();
@@ -1736,8 +1805,7 @@ void KABCore::addActionsManually()
- if (QApplication::desktop()->width() > 320 ) {
+ if (KGlobal::getDesktopSize() > KGlobal::Small ) {
- mActionEditAddressee->plug( tb );
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
- if (QApplication::desktop()->width() > 480 ) {
+ if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
mActionUndo->plug( tb );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6bbdfd4..a45c4c6 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -304,2 +304,8 @@ class KABCore : public QWidget
/**
+ Shows 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*/ );
+
+ /**
Launches the configuration dialog.