-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 @@ -1910,75 +1910,76 @@ void KABCore::initActions() // KDE uses a XML format to plug the actions, but we work her without this overhead. void KABCore::addActionsManually() { //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); #ifdef KAB_EMBEDDED 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 ); mActionMail->plug( fileMenu ); 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 ); fileMenu->insertSeparator(); mActionMailVCard->plug( fileMenu ); #ifndef DESKTOP_VERSION if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); if ( Ir::supported() ) mActionBeam->plug(fileMenu ); #endif @@ -2012,52 +2013,52 @@ void KABCore::addActionsManually() //mActionConfigShortcuts->plug( settingsMenu ); //mActionConfigureToolbars->plug( settingsMenu ); } else { //US not implemented yet //mActionKeyBindings->plug( settingsMenu ); } 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 ); mActionWN->plug( helpMenu ); mActionSyncHowto->plug( helpMenu ); mActionLicence->plug( helpMenu ); mActionFaq->plug( helpMenu ); mActionAboutKAddressbook->plug( helpMenu ); 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. //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); //US tb->insertItem( mIncSearchWidget ); /*US mIncSearchWidget = new IncSearchWidget( tb ); connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 3cbcc9a..db123da 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -58,24 +58,29 @@ KABPrefs::KABPrefs() #ifdef KAB_EMBEDDED addItemBool("AskForQuit",&mAskForQuit,true); addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); addItemBool("SearchWithReturn",&mSearchWithReturn, true ); 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 ); KPrefs::setCurrentGroup( "Extensions_General" ); QStringList defaultExtensions; defaultExtensions << "merge"; defaultExtensions << "distribution_list_editor"; addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index cc8413e..1e3b48f 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -56,24 +56,25 @@ class KABPrefs : public KPimPrefs // void usrSetDefaults(); /** Read preferences from config file */ // void usrReadConfig(); /** Write preferences to config file */ // void usrWriteConfig(); #endif //KAB_EMBEDDED void usrReadConfig(); // GUI + bool mFullMenuBarVisible; bool mJumpButtonBarVisible; bool mDetailsPageVisible; bool mMultipleViewsAtOnce; bool mSearchWithReturn; QValueList<int> mExtensionsSplitter; QValueList<int> mDetailsSplitter; // Extensions stuff int mCurrentExtension; QStringList mActiveExtensions; // Views stuff diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index c134e96..2e91cbc 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h @@ -58,24 +58,25 @@ class KAddressBookView : public QWidget KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); virtual ~KAddressBookView(); /** Must be overloaded in subclasses. Should return a list of 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 removes columns from the view. If overloaded in the subclass, do not forget to call super class's method. @param config The KConfig object to read from. The group will already 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 @@ -110,24 +110,26 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * hboxLayout->addWidget(detailsFont->button()); hboxLayout->setMargin(KDialog::marginHintSmall() ); hboxLayout->setSpacing(KDialog::spacingHintSmall()); //hBox->setBackgroundColor( black); layout->addWidget( hBox ); //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" ); boxLayout->addWidget( mNameParsing ); mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); boxLayout->addWidget( mMultipleViewsAtOnce ); mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); @@ -156,24 +158,25 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * mExtensionView->addColumn( i18n( "Name" ) ); mExtensionView->addColumn( i18n( "Description" ) ); mExtensionView->setMaximumHeight(80); boxLayout->addWidget( mExtensionView ); 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* ) ), SLOT( selectionChanged( QListViewItem* ) ) ); connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), SLOT( itemClicked( QListViewItem* ) ) ); connect( mConfigureButton, SIGNAL( clicked() ), SLOT( configureExtension() ) ); @@ -183,43 +186,43 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * mAddresseeWidget = new AddresseeWidget( this ); tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); } 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 ); mAddresseeWidget->restoreSettings(); restoreExtensionSettings(); blockSignals( blocked ); } 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(); mAddresseeWidget->saveSettings(); saveExtensionSettings(); } 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 @@ -57,19 +57,19 @@ class KABConfigWidget : public KPrefsWidget void itemClicked( QListViewItem* ); private: void restoreExtensionSettings(); void saveExtensionSettings(); 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 @@ -97,25 +97,25 @@ void ViewManager::scrollDOWN() } void ViewManager::restoreSettings() { mViewNameList = KABPrefs::instance()->mViewNames; QString activeViewName = KABPrefs::instance()->mCurrentView; 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 ) { KConfigGroupSaver saver( mCore->config(), it.currentKey() ); it.current()->readConfig( mCore->config() ); } setActiveView( activeViewName ); mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); @@ -294,25 +294,25 @@ void ViewManager::refreshView() refreshView( QString::null ); } void ViewManager::refreshView( const QString &uid ) { if ( mActiveView ) mActiveView->refresh( uid ); } void ViewManager::setFocusAV() { if ( mActiveView ) - mActiveView->setFocus(); + mActiveView->setFocusAV(); } void ViewManager::editView() { if ( !mActiveView ) return; ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); ViewConfigureWidget *wdg = 0; ViewConfigureDialog* dlg = 0; if ( factory ) { // Save the filters so the dialog has the latest set Filter::save( mCore->config(), "Filter", mFilterList ); @@ -588,24 +588,25 @@ void ViewManager::configureFilters() { FilterDialog dlg( this ); dlg.setFilters( mFilterList ); if ( dlg.exec() ) 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" ) ); Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) names.append( (*it).name() ); return names; } @@ -683,25 +684,24 @@ void ViewManager::initActions() action = new KAction( i18n( "Refresh View" ), "reload", 0, this, SLOT( refreshView()), mCore->actionCollection(), "view_refresh" ); action->plug(viewmenu); viewmenu->insertSeparator(); #endif //KAB_EMBEDDED 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 ) ) ); #ifdef KAB_EMBEDDED action->plug(settingsmenu); mActionSelectFilter->plug(viewmenu); #endif //KAB_EMBEDDED } 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 @@ -160,25 +160,30 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, this, SLOT(addresseeExecuted(CardViewItem *))); connect(mCardView, SIGNAL(selectionChanged()), this, SLOT(addresseeSelected())); connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), this, SIGNAL(dropped(QDropEvent*))); connect(mCardView, SIGNAL(startAddresseeDrag()), 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 ); } void KAddressBookCardView::scrollDOWN() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); QApplication::postEvent( mCardView, ev ); } void KAddressBookCardView::readConfig(KConfig *config) 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 @@ -53,24 +53,25 @@ class KAddressBookCardView : public KAddressBookView public: KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); virtual ~KAddressBookCardView(); void doSearch( const QString& s,KABC::Field *field ); virtual QStringList selectedUids(); 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(); protected slots: void addresseeExecuted(CardViewItem *item); void addresseeSelected(); private: 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 @@ -202,24 +202,30 @@ KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, connect(mIconView, SIGNAL(selectionChanged()), this, SLOT(addresseeSelected())); connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), this, SIGNAL(dropped(QDropEvent*))); connect(mIconView, SIGNAL(startAddresseeDrag()), 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 ); } void KAddressBookIconView::scrollDOWN() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); QApplication::postEvent( mIconView, ev ); } void KAddressBookIconView::readConfig(KConfig *config) 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 @@ -54,24 +54,25 @@ class KAddressBookIconView : public KAddressBookView public: KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); virtual ~KAddressBookIconView(); virtual QStringList selectedUids(); 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); //MOC_SKIP_END #else //KAB_EMBEDDED //US my MOC do not like default parameters ??? void setSelected(QString uid, bool selected); #endif //KAB_EMBEDDED 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 @@ -42,24 +42,30 @@ KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent, const char *name ) : KAddressBookView( ab, parent, name ) { mainLayout = new QVBoxLayout( viewWidget(), 2 ); // The list view will be created when the config is read. 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() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); QApplication::postEvent( mListView, ev ); } void KAddressBookTableView::reconstructListView() { 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 @@ -56,24 +56,25 @@ friend class ContactListView; const char *name = 0 ); virtual ~KAddressBookTableView(); virtual void refresh(QString uid = QString::null); virtual QStringList selectedUids(); virtual void setSelected(QString uid = QString::null, bool selected = false); 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. */ void addresseeSelected(); void addresseeDeleted(); /** Called whenever the user executes an addressee. In terms of the * list view, this is probably a double click |