-rw-r--r-- | kaddressbook/kabcore.cpp | 87 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 1 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 1 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.h | 1 |
13 files changed, 80 insertions, 49 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index b0cb986..4964a6c 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1916,48 +1916,49 @@ void KABCore::addActionsManually() QPopupMenu *fileMenu = new QPopupMenu( this ); QPopupMenu *editMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); KToolBar* tb = mMainWindow->toolBar(); -#ifdef DESKTOP_VERSION - QMenuBar* mb = mMainWindow->menuBar(); - - //US setup menubar. - //Disable the following block if you do not want to have a menubar. - mb->insertItem( "&File", fileMenu ); - mb->insertItem( "&Edit", editMenu ); - mb->insertItem( "&View", viewMenu ); - mb->insertItem( "&Settings", settingsMenu ); - mb->insertItem( i18n("Synchronize"), syncMenu ); - mb->insertItem( "&Change selected", changeMenu ); - mb->insertItem( "&Help", helpMenu ); - mIncSearchWidget = new IncSearchWidget( tb ); - // tb->insertWidget(-1, 0, mIncSearchWidget); - -#else - //US setup toolbar - QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); - QPopupMenu *popupBarTB = new QPopupMenu( this ); - menuBarTB->insertItem( "ME", popupBarTB); - tb->insertWidget(-1, 0, menuBarTB); - mIncSearchWidget = new IncSearchWidget( tb ); - tb->enableMoving(false); - popupBarTB->insertItem( "&File", fileMenu ); - popupBarTB->insertItem( "&Edit", editMenu ); - popupBarTB->insertItem( "&View", viewMenu ); - popupBarTB->insertItem( "&Settings", settingsMenu ); - popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); - mViewManager->getFilterAction()->plug ( popupBarTB); - popupBarTB->insertItem( "&Change selected", changeMenu ); - popupBarTB->insertItem( "&Help", helpMenu ); - if (QApplication::desktop()->width() > 320 ) { - // mViewManager->getFilterAction()->plug ( tb); + if ( KABPrefs::instance()->mFullMenuBarVisible ) { + QMenuBar* mb = mMainWindow->menuBar(); + + //US setup menubar. + //Disable the following block if you do not want to have a menubar. + mb->insertItem( "&File", fileMenu ); + mb->insertItem( "&Edit", editMenu ); + mb->insertItem( "&View", viewMenu ); + mb->insertItem( "&Settings", settingsMenu ); + mb->insertItem( i18n("Synchronize"), syncMenu ); + mb->insertItem( "&Change selected", changeMenu ); + mb->insertItem( "&Help", helpMenu ); + mIncSearchWidget = new IncSearchWidget( tb ); + // tb->insertWidget(-1, 0, mIncSearchWidget); + + } else { + //US setup toolbar + QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); + QPopupMenu *popupBarTB = new QPopupMenu( this ); + menuBarTB->insertItem( "ME", popupBarTB); + tb->insertWidget(-1, 0, menuBarTB); + mIncSearchWidget = new IncSearchWidget( tb ); + + tb->enableMoving(false); + popupBarTB->insertItem( "&File", fileMenu ); + popupBarTB->insertItem( "&Edit", editMenu ); + popupBarTB->insertItem( "&View", viewMenu ); + popupBarTB->insertItem( "&Settings", settingsMenu ); + popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); + mViewManager->getFilterAction()->plug ( popupBarTB); + popupBarTB->insertItem( "&Change selected", changeMenu ); + popupBarTB->insertItem( "&Help", helpMenu ); + if (QApplication::desktop()->width() > 320 ) { + // mViewManager->getFilterAction()->plug ( tb); + } } -#endif // mActionQuit->plug ( mMainWindow->toolBar()); //US Now connect the actions with the menue entries. mActionPrint->plug( fileMenu ); @@ -1965,14 +1966,14 @@ void KABCore::addActionsManually() fileMenu->insertSeparator(); mActionNewContact->plug( fileMenu ); mActionNewContact->plug( tb ); mActionEditAddressee->plug( fileMenu ); - if ((KGlobal::getDesktopSize() > KGlobal::Small ) || - (!KABPrefs::instance()->mMultipleViewsAtOnce )) + // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || + // (!KABPrefs::instance()->mMultipleViewsAtOnce )) mActionEditAddressee->plug( tb ); fileMenu->insertSeparator(); mActionSave->plug( fileMenu ); fileMenu->insertItem( "&Import", ImportMenu ); fileMenu->insertItem( "&Export", ExportMenu ); @@ -2018,14 +2019,14 @@ void KABCore::addActionsManually() } settingsMenu->insertSeparator(); mActionJumpBar->plug( settingsMenu ); mActionDetails->plug( settingsMenu ); - if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) - mActionDetails->plug( tb ); + //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) + mActionDetails->plug( tb ); settingsMenu->insertSeparator(); mActionBR->plug(settingsMenu ); settingsMenu->insertSeparator(); mActionWhoAmI->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); @@ -2039,19 +2040,19 @@ void KABCore::addActionsManually() if (KGlobal::getDesktopSize() > KGlobal::Small ) { mActionSave->plug( tb ); mViewManager->getFilterAction()->plug ( tb); if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { - mActionUndo->plug( tb ); - mActionDelete->plug( tb ); - mActionRedo->plug( tb ); + mActionUndo->plug( tb ); + mActionDelete->plug( tb ); + mActionRedo->plug( tb ); } } else { - if (KABPrefs::instance()->mMultipleViewsAtOnce ) - mActionSave->plug( tb ); + mActionSave->plug( tb ); + tb->enableMoving(false); } //mActionQuit->plug ( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget, 6); //US link the searchwidget first to this. // The real linkage to the toolbar happens later. diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 3cbcc9a..db123da 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -64,12 +64,17 @@ KABPrefs::KABPrefs() addItemFont("DetailsFont",&mDetailsFont); #endif //KAB_EMBEDDED KPrefs::setCurrentGroup( "MainWindow" ); + bool m_visible = false; +#ifdef DESKTOP_VERSION + m_visible = true; +#endif + addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); addItemIntList( "DetailsSplitter", &mDetailsSplitter ); addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index cc8413e..1e3b48f 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -62,12 +62,13 @@ class KABPrefs : public KPimPrefs // void usrWriteConfig(); #endif //KAB_EMBEDDED void usrReadConfig(); // GUI + bool mFullMenuBarVisible; bool mJumpButtonBarVisible; bool mDetailsPageVisible; bool mMultipleViewsAtOnce; bool mSearchWithReturn; QValueList<int> mExtensionsSplitter; QValueList<int> mDetailsSplitter; diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index c134e96..2e91cbc 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h @@ -64,12 +64,13 @@ class KAddressBookView : public QWidget all the uids of selected contacts. */ virtual QStringList selectedUids() = 0; virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; virtual void scrollUP() = 0; virtual void scrollDOWN() = 0; + virtual void setFocusAV() = 0; /** Called whenever this view should read the config. This can be used as a sign that the config has changed, therefore the view should assume the worst and rebuild itself if necessary. For example, in a table view this method may be called when the user adds or diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 936d052..8bf9bb0 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp @@ -116,12 +116,14 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * //general groupbox QWidget *vBox = new QWidget( generalPage, "qvbox" ); QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall() ); boxLayout->setSpacing( KDialog::spacingHintSmall() ); + mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); + boxLayout->addWidget( mMenuBarBox ); mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); boxLayout->addWidget( mSearchReturnBox ); mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); boxLayout->addWidget( mViewsSingleClickBox ); mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); @@ -162,12 +164,13 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); mConfigureButton->setEnabled( false ); boxLayout->addWidget( mConfigureButton ); extensionLayout->addWidget( groupBox ); + connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), @@ -189,13 +192,13 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * void KABConfigWidget::usrReadConfig() { KABPrefs* prefs = KABPrefs::instance(); bool blocked = signalsBlocked(); blockSignals( true ); - + mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); mNameParsing->setChecked( prefs->mAutomaticNameParsing ); mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); mAskForQuit->setChecked( prefs->mAskForQuit ); @@ -207,13 +210,13 @@ void KABConfigWidget::usrReadConfig() } void KABConfigWidget::usrWriteConfig() { KABPrefs* prefs = KABPrefs::instance(); - + prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); prefs->mAutomaticNameParsing = mNameParsing->isChecked(); prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); prefs->mAskForQuit = mAskForQuit->isChecked(); diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 1e71fd1..08d71b4 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h @@ -63,13 +63,13 @@ class KABConfigWidget : public KPrefsWidget KListView *mExtensionView; QCheckBox *mSearchReturnBox; QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; QCheckBox *mMultipleViewsAtOnce; QCheckBox *mAskForQuit; - + QCheckBox *mMenuBarBox; QPushButton *mConfigureButton; AddresseeWidget *mAddresseeWidget; }; #endif diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 81e0d99..3d0c275 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -103,13 +103,13 @@ void ViewManager::restoreSettings() mActionSelectView->setItems( mViewNameList ); // Filter mFilterList = Filter::restore( mCore->config(), "Filter" ); mActionSelectFilter->setItems( filterNames() ); mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); - + mActionSelectFilter->setComboWidth( 100 ); // Tell the views to reread their config, since they may have // been modified by global settings QString _oldgroup = mCore->config()->group(); QDictIterator<KAddressBookView> it( mViewDict ); for ( it.toFirst(); it.current(); ++it ) { @@ -300,13 +300,13 @@ void ViewManager::refreshView( const QString &uid ) mActiveView->refresh( uid ); } void ViewManager::setFocusAV() { if ( mActiveView ) - mActiveView->setFocus(); + mActiveView->setFocusAV(); } void ViewManager::editView() { if ( !mActiveView ) return; @@ -594,12 +594,13 @@ void ViewManager::configureFilters() mFilterList = dlg.filters(); uint pos = mActionSelectFilter->currentItem(); mActionSelectFilter->setItems( filterNames() ); mActionSelectFilter->setCurrentItem( pos ); setActiveFilter( pos ); + //mActionSelectFilter->setComboWidth( 150 ); } QStringList ViewManager::filterNames() const { QStringList names( i18n( "No Filter" ) ); @@ -689,13 +690,12 @@ void ViewManager::initActions() action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, SLOT( configureFilters() ), mCore->actionCollection(), "options_edit_filters" ); mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); - #if KDE_VERSION >= 309 mActionSelectFilter->setMenuAccelsEnabled( false ); #endif connect( mActionSelectFilter, SIGNAL( activated( int ) ), SLOT( setActiveFilter( int ) ) ); diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index a7bf6c9..7f33bb4 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp @@ -166,13 +166,18 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, this, SIGNAL(startDrag())); } KAddressBookCardView::~KAddressBookCardView() { } +void KAddressBookCardView::setFocusAV() +{ + if ( mCardView ) + mCardView->setFocus(); +} void KAddressBookCardView::scrollUP() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); QApplication::postEvent( mCardView, ev ); } diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index 45a9781..8f22d54 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h @@ -59,12 +59,13 @@ class KAddressBookCardView : public KAddressBookView virtual QString type() const { return "Card"; } virtual void readConfig(KConfig *config); virtual void writeConfig(KConfig *); virtual void scrollUP(); virtual void scrollDOWN(); + virtual void setFocusAV(); public slots: void refresh(QString uid = QString::null); void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); //US added an additional method without parameter void setSelected(); diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index f4c68b8..41c3cb2 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp @@ -208,12 +208,18 @@ KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, this, SIGNAL(startDrag())); } KAddressBookIconView::~KAddressBookIconView() { } +void KAddressBookIconView::setFocusAV() +{ + if ( mIconView ) + mIconView->setFocus(); +} + void KAddressBookIconView::scrollUP() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); QApplication::postEvent( mIconView, ev ); } diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h index acfcd71..b0b9fea 100644 --- a/kaddressbook/views/kaddressbookiconview.h +++ b/kaddressbook/views/kaddressbookiconview.h @@ -60,12 +60,13 @@ class KAddressBookIconView : public KAddressBookView virtual QString type() const { return "Icon"; } void doSearch( const QString& s ,KABC::Field *field ); virtual void readConfig(KConfig *config); virtual void scrollUP(); virtual void scrollDOWN(); + virtual void setFocusAV(); public slots: void refresh(QString uid = QString::null); #ifndef KAB_EMBEDDED //MOC_SKIP_BEGIN void setSelected(QString uid = QString::null, bool selected = true); diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 2412170..e40eb9e 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -48,12 +48,18 @@ KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, mListView = 0; } KAddressBookTableView::~KAddressBookTableView() { } +void KAddressBookTableView::setFocusAV() +{ + if ( mListView ) + mListView->setFocus(); + +} void KAddressBookTableView::scrollUP() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); QApplication::postEvent( mListView, ev ); } void KAddressBookTableView::scrollDOWN() diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h index 865f8d5..38db7b4 100644 --- a/kaddressbook/views/kaddressbooktableview.h +++ b/kaddressbook/views/kaddressbooktableview.h @@ -62,12 +62,13 @@ friend class ContactListView; virtual void readConfig(KConfig *config); virtual void writeConfig(KConfig *config); virtual QString type() const { return "Table"; } void doSearch( const QString& s ,KABC::Field *field ); virtual void scrollUP(); virtual void scrollDOWN(); + virtual void setFocusAV(); public slots: virtual void reconstructListView(); protected slots: /** Called whenever the user selects an addressee in the list view. |