summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorulf69 <ulf69>2004-08-11 19:22:09 (UTC)
committer ulf69 <ulf69>2004-08-11 19:22:09 (UTC)
commit34681e7392fbed71cc48f615b5cd88614a581396 (patch) (side-by-side diff)
treed2265acfba7dd6362565762c70621a9de0595244 /kaddressbook
parentf79407b018b3abd9a99ccd259f1ff24f3bfee6a4 (diff)
downloadkdepimpi-34681e7392fbed71cc48f615b5cd88614a581396.zip
kdepimpi-34681e7392fbed71cc48f615b5cd88614a581396.tar.gz
kdepimpi-34681e7392fbed71cc48f615b5cd88614a581396.tar.bz2
added functionality to support the multiple view config setting
Diffstat (limited to 'kaddressbook') (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
@@ -188,26 +188,18 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
connect( mViewManager, SIGNAL( selected( const QString& ) ),
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& ) ) );
- }
+ connect( mViewManager, SIGNAL( executed( const QString& ) ),
+ SLOT( executeContact( const QString& ) ) );
connect( mViewManager, SIGNAL( deleteRequest( ) ),
SLOT( deleteContacts( ) ) );
connect( mViewManager, SIGNAL( modified() ),
SLOT( setModified() ) );
connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
+ connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
connect( mXXPortManager, SIGNAL( modified() ),
SLOT( setModified() ) );
@@ -245,12 +237,13 @@ KABCore::~KABCore()
}
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;
else
state = false;
@@ -260,9 +253,9 @@ void KABCore::restoreSettings()
state = KABPrefs::instance()->mJumpButtonBarVisible;
mActionJumpBar->setChecked( state );
setJumpButtonBarVisible( state );
-
+/*US
QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
if ( splitterSize.count() == 0 ) {
splitterSize.append( width() / 2 );
splitterSize.append( width() / 2 );
@@ -276,30 +269,30 @@ void KABCore::restoreSettings()
}
mExtensionBarSplitter->setSizes( splitterSize );
}
-#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 ) {
splitterSize.append( width() / 2 );
splitterSize.append( width() / 2 );
}
- 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();
}
void KABCore::saveSettings()
{
@@ -429,9 +422,9 @@ void KABCore::createAboutData()
void KABCore::setContactSelected( const QString &uid )
{
KABC::Addressee addr = mAddressBook->findByUid( uid );
-//US if ( !mDetails->isHidden() )
+ if ( !mDetails->isHidden() )
mDetails->setAddressee( addr );
if ( !addr.isEmpty() ) {
emit contactSelected( addr.formattedName() );
@@ -1056,16 +1049,23 @@ 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*/ )
{
- setDetailsVisible( true );
- mActionDetails->setChecked(true);
+ if ( mMultipleViewsAtOnce )
+ {
+ editContact( uid );
+ }
+ else
+ {
+ setDetailsVisible( true );
+ mActionDetails->setChecked(true);
+ }
+
}
void KABCore::save()
{
@@ -1113,17 +1113,18 @@ void KABCore::redo()
}
void KABCore::setJumpButtonBarVisible( bool visible )
{
- if (KGlobal::getDesktopSize() > KGlobal::Small ) {
+ if (mMultipleViewsAtOnce)
+ {
if ( visible )
mJumpButtonBar->show();
else
mJumpButtonBar->hide();
}
else
{
- // 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())
{
if ( visible )
mJumpButtonBar->show();
@@ -1135,8 +1136,10 @@ void KABCore::setJumpButtonBarVisible( bool visible )
mJumpButtonBar->hide();
}
}
}
+
+
void KABCore::setDetailsToState()
{
setDetailsVisible( mActionDetails->isChecked() );
}
@@ -1144,14 +1147,19 @@ void KABCore::setDetailsToState()
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 )
mDetails->show();
else
mDetails->hide();
@@ -1160,19 +1168,60 @@ void KABCore::setDetailsVisible( bool visible )
{
if ( visible ) {
mViewManager->hide();
mDetails->show();
-// mDetails->show();
}
else {
mViewManager->show();
mDetails->hide();
}
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 )
{
if ( list.count() != 0 ) {
@@ -1243,9 +1292,9 @@ void KABCore::openConfigDialog()
this, SLOT( configurationChanged() ) );
saveSettings();
ConfigureDialog->showMaximized();
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;
}
void KABCore::openLDAPDialog()
@@ -1744,9 +1793,12 @@ void KABCore::addActionsManually()
mActionNewContact->plug( fileMenu );
mActionNewContact->plug( tb );
mActionEditAddressee->plug( fileMenu );
- mActionEditAddressee->plug( tb );
+ if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
+ (!KABPrefs::instance()->mMultipleViewsAtOnce ))
+ mActionEditAddressee->plug( tb );
+
fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Emport", ExportMenu );
@@ -1792,9 +1844,9 @@ void KABCore::addActionsManually()
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
- if (KGlobal::getDesktopSize() == KGlobal::Small )
+ if (!KABPrefs::instance()->mMultipleViewsAtOnce )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index a45c4c6..d4d28f1 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -301,12 +301,12 @@ class KABCore : public QWidget
//US added a second method without defaultparameter
void editContact2();
/**
- 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*/ );
/**
Launches the configuration dialog.
*/
@@ -337,8 +337,9 @@ class KABCore : public QWidget
private slots:
void setJumpButtonBarVisible( bool visible );
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
+ void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
@@ -380,8 +381,10 @@ class KABCore : public QWidget
AddresseeEditorDialog *mEditorDialog;
bool mReadWrite;
bool mModified;
bool mIsPart;
+ bool mMultipleViewsAtOnce;
+
//US file menu
KAction *mActionMail;
KAction *mActionBeam;