author | zautrix <zautrix> | 2005-04-02 12:16:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-02 12:16:34 (UTC) |
commit | 997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (patch) (side-by-side diff) | |
tree | f788b37459574b5cea0d2ab874882c6a396c240d /kaddressbook | |
parent | e0d51120d2f0c178115746e0c1357af40f95bc77 (diff) | |
download | kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.zip kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.gz kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.bz2 |
more fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 3 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/colorlistbox.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/views/colorlistbox.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/configurecardviewdialog.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/views/configuretableviewdialog.cpp | 4 |
6 files changed, 18 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 5ef61b1..e34951a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -306,193 +306,193 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const KABC::StdAddressBook::setAutomaticSave( false ); #ifndef KAB_EMBEDDED mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); #endif //KAB_EMBEDDED connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), SLOT( addressBookChanged() ) ); #if 0 // LR moved to addressbook init method mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, "X-Department", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, "X-Profession", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, "X-AssistantsName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, "X-ManagersName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, "X-SpousesName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, "X-Office", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, "X-IMAddress", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, "X-Anniversary", "KADDRESSBOOK" ); //US added this field to become compatible with Opie/qtopia addressbook // values can be "female" or "male" or "". An empty field represents undefined. mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, "X-Gender", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, "X-Children", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, "X-FreeBusyUrl", "KADDRESSBOOK" ); #endif initGUI(); mIncSearchWidget->setFocus(); connect( mViewManager, SIGNAL( selected( const QString& ) ), SLOT( setContactSelected( 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() ) ); connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), SLOT( incrementalSearchJump( const QString& ) ) ); connect( mIncSearchWidget, SIGNAL( fieldChanged() ), mJumpButtonBar, SLOT( recreateButtons() ) ); connect( mDetails, SIGNAL( sendEmail( const QString& ) ), SLOT( sendMail( const QString& ) ) ); connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); #ifndef KAB_EMBEDDED connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), mXXPortManager, SLOT( importVCard( const KURL& ) ) ); connect( mDetails, SIGNAL( browse( const QString& ) ), SLOT( browse( const QString& ) ) ); mAddressBookService = new KAddressBookService( this ); #endif //KAB_EMBEDDED mMessageTimer = new QTimer( this ); connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); mEditorDialog = 0; createAddresseeEditorDialog( this ); setModified( false ); mBRdisabled = false; #ifndef DESKTOP_VERSION infrared = 0; #endif //toggleBeamReceive( ); - //mMainWindow->toolBar()->show(); + mMainWindow->toolBar()->show(); // we have a toolbar repainting error on the Zaurus when starting KA/Pi QTimer::singleShot( 10, this , SLOT ( updateToolBar())); } void KABCore::updateToolBar() { static int iii = 0; ++iii; mMainWindow->toolBar()->repaintMe(); if ( iii < 4 ) QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); } KABCore::~KABCore() { // save(); //saveSettings(); //KABPrefs::instance()->writeConfig(); delete AddresseeConfig::instance(); mAddressBook = 0; KABC::StdAddressBook::close(); delete syncManager; #ifndef DESKTOP_VERSION if ( infrared ) delete infrared; #endif } void KABCore::receive( const QCString& cmsg, const QByteArray& data ) { //qDebug("KA: QCOP message received: %s ", cmsg.data() ); if ( cmsg == "setDocument(QString)" ) { QDataStream stream( data, IO_ReadOnly ); QString fileName; stream >> fileName; recieve( fileName ); return; } } void KABCore::toggleBeamReceive( ) { if ( mBRdisabled ) return; #ifndef DESKTOP_VERSION if ( infrared ) { qDebug("KA: AB disable BeamReceive "); delete infrared; infrared = 0; mActionBR->setChecked(false); return; } qDebug("KA: AB enable BeamReceive "); mActionBR->setChecked(true); infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); #endif } void KABCore::disableBR(bool b) { #ifndef DESKTOP_VERSION if ( b ) { if ( infrared ) { toggleBeamReceive( ); } mBRdisabled = true; } else { if ( mBRdisabled ) { mBRdisabled = false; //toggleBeamReceive( ); } } #endif } void KABCore::recieve( QString fn ) { //qDebug("KABCore::recieve "); int count = mAddressBook->importFromFile( fn, true ); if ( count ) setModified( true ); mViewManager->refreshView(); message(i18n("%1 contact(s) received!").arg( count )); topLevelWidget()->showMaximized(); topLevelWidget()->raise(); } void KABCore::restoreSettings() { mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; bool state; if (mMultipleViewsAtOnce) state = KABPrefs::instance()->mDetailsPageVisible; else @@ -2080,192 +2080,193 @@ void KABCore::initActions() SLOT( setFormattedName() ), actionCollection(), "set_formatted" ); mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, SLOT( manageCategories() ), actionCollection(), "remove_voice" ); mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, SLOT( importFromOL() ), actionCollection(), "import_OL" ); #ifdef KAB_EMBEDDED mActionLicence = new KAction( i18n( "Licence" ), 0, this, SLOT( showLicence() ), actionCollection(), "licence_about_data" ); mActionFaq = new KAction( i18n( "Faq" ), 0, this, SLOT( faq() ), actionCollection(), "faq_about_data" ); mActionWN = new KAction( i18n( "What's New?" ), 0, this, SLOT( whatsnew() ), actionCollection(), "wn" ); mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, this, SLOT( synchowto() ), actionCollection(), "sync" ); mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, this, SLOT( kdesynchowto() ), actionCollection(), "kdesync" ); mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, this, SLOT( multisynchowto() ), actionCollection(), "multisync" ); mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, this, SLOT( createAboutData() ), actionCollection(), "kaddressbook_about_data" ); #endif //KAB_EMBEDDED clipboardDataChanged(); connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); } //US we need this function, to plug all actions into the correct menues. // 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(); mMainWindow->setToolBarsMovable (false ); #ifndef DESKTOP_VERSION if ( KABPrefs::instance()->mFullMenuBarVisible ) { #endif QMenuBar* mb = mMainWindow->menuBar(); //US setup menubar. //Disable the following block if you do not want to have a menubar. mb->insertItem( i18n("&File"), fileMenu ); mb->insertItem( i18n("&Edit"), editMenu ); mb->insertItem( i18n("&View"), viewMenu ); mb->insertItem( i18n("&Settings"), settingsMenu ); #ifdef DESKTOP_VERSION mb->insertItem( i18n("Synchronize"), syncMenu ); #else mb->insertItem( i18n("Sync"), syncMenu ); #endif //mb->insertItem( i18n("&Change"), changeMenu ); mb->insertItem( i18n("&Help"), helpMenu ); mIncSearchWidget = new IncSearchWidget( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget); #ifndef DESKTOP_VERSION } else { //US setup toolbar QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); QPopupMenu *popupBarTB = new QPopupMenu( this ); menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); tb->insertWidget(-1, 0, menuBarTB); mIncSearchWidget = new IncSearchWidget( tb ); tb->enableMoving(false); popupBarTB->insertItem( i18n("&File"), fileMenu ); popupBarTB->insertItem( i18n("&Edit"), editMenu ); popupBarTB->insertItem( i18n("&View"), viewMenu ); popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); mViewManager->getFilterAction()->plug ( popupBarTB); //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); popupBarTB->insertItem( i18n("&Help"), helpMenu ); if (QApplication::desktop()->width() > 320 ) { // mViewManager->getFilterAction()->plug ( tb); } } #endif + mIncSearchWidget->setSize(); // mActionQuit->plug ( mMainWindow->toolBar()); //US Now connect the actions with the menue entries. #ifdef DESKTOP_VERSION mActionPrint->plug( fileMenu ); mActionPrintDetails->plug( fileMenu ); fileMenu->insertSeparator(); #endif mActionMail->plug( fileMenu ); fileMenu->insertSeparator(); mActionNewContact->plug( editMenu ); mActionNewContact->plug( tb ); mActionEditAddressee->plug( editMenu ); editMenu->insertSeparator(); // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || // (!KABPrefs::instance()->mMultipleViewsAtOnce )) mActionEditAddressee->plug( tb ); // fileMenu->insertSeparator(); mActionSave->plug( fileMenu ); fileMenu->insertItem( "&Import", ImportMenu ); fileMenu->insertItem( "&Export", ExportMenu ); editMenu->insertItem( i18n("&Change"), changeMenu ); editMenu->insertSeparator(); #ifndef DESKTOP_VERSION if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); #endif #if 0 // PENDING fix MailVCard fileMenu->insertSeparator(); mActionMailVCard->plug( fileMenu ); #endif #ifndef DESKTOP_VERSION if ( Ir::supported() ) mActionBR->plug( beamMenu ); if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); if ( Ir::supported() ) mActionBeam->plug( beamMenu ); #endif fileMenu->insertSeparator(); mActionQuit->plug( fileMenu ); #ifdef _OL_IMPORT_ mActionImportOL->plug( ImportMenu ); #endif // edit menu mActionUndo->plug( editMenu ); mActionRedo->plug( editMenu ); editMenu->insertSeparator(); mActionCut->plug( editMenu ); mActionCopy->plug( editMenu ); mActionPaste->plug( editMenu ); mActionDelete->plug( editMenu ); editMenu->insertSeparator(); mActionSelectAll->plug( editMenu ); mActionSetFormattedName->plug( changeMenu ); mActionRemoveVoice->plug( changeMenu ); // settingsmings menu //US special menuentry to configure the addressbook resources. On KDE // you do that through the control center !!! // settingsMenu->insertSeparator(); mActionConfigKAddressbook->plug( settingsMenu, 0 ); mActionConfigResources->plug( settingsMenu,1 ); settingsMenu->insertSeparator(2); if ( mIsPart ) { //US not implemented yet //mActionConfigShortcuts->plug( settingsMenu ); //mActionConfigureToolbars->plug( settingsMenu ); } else { //US not implemented yet //mActionKeyBindings->plug( settingsMenu ); } mActionEditCategories->plug( settingsMenu ); mActionManageCategories->plug( settingsMenu ); mActionJumpBar->plug( viewMenu,0 ); mActionDetails->plug( viewMenu,0 ); //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) mActionDetails->plug( tb ); settingsMenu->insertSeparator(); #ifndef DESKTOP_VERSION if ( Ir::supported() ) mActionBR->plug(settingsMenu ); settingsMenu->insertSeparator(); #endif mActionWhoAmI->plug( settingsMenu ); //mActionEditCategories->plug( changeMenu ); mActionCategories->plug( changeMenu ); //mActionManageCategories->plug( changeMenu ); //mActionCategories->plug( settingsMenu ); diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 86f0f3d..0614d06 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -611,127 +611,127 @@ void ViewManager::configureFilters() } 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; } Filter ViewManager::getFilterByName( const QString &name ) const { Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) if ( name == (*it).name() ) return (*it); return Filter(); } int ViewManager::filterPosition( const QString &name ) const { int pos = 0; Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) if ( name == (*it).name() ) return pos + 1; return 0; } void ViewManager::initActions() { //US <ActionList name="view_loadedviews"/> //US <Separator/> #ifdef KAB_EMBEDDED QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); #endif //KAB_EMBEDDED mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); #if KDE_VERSION >= 309 mActionSelectView->setMenuAccelsEnabled( false ); #endif connect( mActionSelectView, SIGNAL( activated( const QString& ) ), SLOT( selectView( const QString& ) ) ); #ifdef KAB_EMBEDDED mActionSelectView->plug(viewmenu); viewmenu->insertSeparator(); #endif //KAB_EMBEDDED KAction *action; action = new KAction( i18n( "Modify View..." ), "configure", 0, this, SLOT( editView() ), mCore->actionCollection(), "view_modify" ); #ifndef KAB_EMBEDDED action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); #else //KAB_EMBEDDED action->plug(viewmenu); #endif //KAB_EMBEDDED action = new KAction( i18n( "Add View..." ), "window_new", 0, this, SLOT( addView() ), mCore->actionCollection(), "view_add" ); #ifndef KAB_EMBEDDED action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); #else //KAB_EMBEDDED action->plug(viewmenu); #endif //KAB_EMBEDDED mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, this, SLOT( deleteView() ), mCore->actionCollection(), "view_delete" ); #ifndef KAB_EMBEDDED mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); #else //KAB_EMBEDDED mActionDeleteView->plug(viewmenu); viewmenu->insertSeparator(); #endif //KAB_EMBEDDED #ifndef KAB_EMBEDDED action = new KAction( i18n( "Refresh View" ), "reload", 0, this, SLOT( refreshView(const QString &) ), mCore->actionCollection(), "view_refresh" ); action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); #else //KAB_EMBEDDED action = new KAction( i18n( "Refresh View" ), "reload", 0, this, SLOT( refreshView()), mCore->actionCollection(), "view_refresh" ); action->plug(viewmenu); - viewmenu->insertSeparator(); + //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,0); #endif //KAB_EMBEDDED } void ViewManager::initGUI() { QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); mViewWidgetStack = new QWidgetStack( this ); layout->addWidget( mViewWidgetStack ); } #ifndef KAB_EMBEDDED #include "viewmanager.moc" #endif //KAB_EMBEDDED diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp index c243fa0..7386207 100644 --- a/kaddressbook/views/colorlistbox.cpp +++ b/kaddressbook/views/colorlistbox.cpp @@ -1,173 +1,178 @@ /* * kmail: KDE mail client * This file: Copyright (C) 2000 Espen Sand, espen@kde.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include <qpainter.h> #include <kcolordialog.h> #ifndef KAB_EMBEDDED #include <kcolordrag.h> #endif //KAB_EMBEDDED #include "colorlistbox.h" ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f ) :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) { connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); + connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) ); setAcceptDrops( true); } void ColorListBox::setEnabled( bool state ) { if( state == isEnabled() ) { return; } QListBox::setEnabled( state ); for( uint i=0; i<count(); i++ ) { updateItem( i ); } } void ColorListBox::setColor( uint index, const QColor &color ) { if( index < count() ) { ColorListItem *colorItem = (ColorListItem*)item(index); colorItem->setColor(color); updateItem( colorItem ); } } QColor ColorListBox::color( uint index ) const { if( index < count() ) { ColorListItem *colorItem = (ColorListItem*)item(index); return( colorItem->color() ); } else { return( black ); } } - +void ColorListBox::slotNewColor(QListBoxItem * i) +{ + if ( i ) + newColor( index( i ) ); +} void ColorListBox::newColor( int index ) { if( isEnabled() == false ) { return; } if( (uint)index < count() ) { QColor c = color( index ); #ifndef KAB_EMBEDDED if( KColorDialog::getColor( c, this ) != QDialog::Rejected ) { setColor( index, c ); } #else //KAB_EMBEDDED KColorDialog* k = new KColorDialog( this ); k->setColor( c ); int res = k->exec(); if ( res ) { setColor( index, k->getColor() ); } delete k; #endif //KAB_EMBEDDED } } void ColorListBox::dragEnterEvent( QDragEnterEvent *e ) { #ifndef KAB_EMBEDDED if( KColorDrag::canDecode(e) && isEnabled() ) { mCurrentOnDragEnter = currentItem(); e->accept( true ); } else { mCurrentOnDragEnter = -1; e->accept( false ); } #else //KAB_EMBEDDED qDebug("ColorListBox::dragEnterEvent drag&drop currently not supported"); #endif //KAB_EMBEDDED } void ColorListBox::dragLeaveEvent( QDragLeaveEvent * ) { #ifndef KAB_EMBEDDED if( mCurrentOnDragEnter != -1 ) { setCurrentItem( mCurrentOnDragEnter ); mCurrentOnDragEnter = -1; } #else //KAB_EMBEDDED qDebug("ColorListBox::dragLeaveEvent drag&drop currently not supported"); #endif //KAB_EMBEDDED } void ColorListBox::dragMoveEvent( QDragMoveEvent *e ) { #ifndef KAB_EMBEDDED if( KColorDrag::canDecode(e) && isEnabled() ) { ColorListItem *item = (ColorListItem*)itemAt( e->pos() ); if( item != 0 ) { setCurrentItem ( item ); } } #else //KAB_EMBEDDED qDebug("ColorListBox::dragMoveEvent drag&drop currently not supported"); #endif //KAB_EMBEDDED } void ColorListBox::dropEvent( QDropEvent *e ) { #ifndef KAB_EMBEDDED QColor color; if( KColorDrag::decode( e, color ) ) { int index = currentItem(); if( index != -1 ) { ColorListItem *colorItem = (ColorListItem*)item(index); colorItem->setColor(color); triggerUpdate( false ); // Redraw item } diff --git a/kaddressbook/views/colorlistbox.h b/kaddressbook/views/colorlistbox.h index 4a0e705..bb91484 100644 --- a/kaddressbook/views/colorlistbox.h +++ b/kaddressbook/views/colorlistbox.h @@ -1,76 +1,77 @@ /* * kmail: KDE mail client * This file: Copyright (C) 2000 Espen Sand, espen@kde.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _COLOR_LISTBOX_H_ #define _COLOR_LISTBOX_H_ #include <klistbox.h> class QDragEnterEvent; class QDragLeaveEvent; class QDragMoveEvent; class QDropEvent; class ColorListBox : public KListBox { Q_OBJECT public: ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 ); void setColor( uint index, const QColor &color ); QColor color( uint index ) const; public slots: virtual void setEnabled( bool state ); protected: void dragEnterEvent( QDragEnterEvent *e ); void dragLeaveEvent( QDragLeaveEvent *e ); void dragMoveEvent( QDragMoveEvent *e ); void dropEvent( QDropEvent *e ); private slots: void newColor( int index ); + void slotNewColor(QListBoxItem * i); private: int mCurrentOnDragEnter; }; class ColorListItem : public QListBoxItem { public: ColorListItem( const QString &text, const QColor &color=Qt::black ); const QColor &color( void ); void setColor( const QColor &color ); protected: virtual void paint( QPainter * ); virtual int height( const QListBox * ) const; virtual int width( const QListBox * ) const; private: QColor mColor; int mBoxWidth; }; #endif diff --git a/kaddressbook/views/configurecardviewdialog.cpp b/kaddressbook/views/configurecardviewdialog.cpp index 366e54c..e0fbd21 100644 --- a/kaddressbook/views/configurecardviewdialog.cpp +++ b/kaddressbook/views/configurecardviewdialog.cpp @@ -122,197 +122,201 @@ qDebug("CardViewLookNFeelPage::restoreSettings make base color configurable"); config->readColorEntry( "HeaderColor", &c ) ) ); c = colorGroup().buttonText(); lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), config->readColorEntry( "HeaderTextColor", &c ) ) ); c = colorGroup().highlight(); lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), config->readColorEntry( "HighlightColor", &c ) ) ); c = colorGroup().highlightedText(); lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), config->readColorEntry( "HighlightedTextColor", &c ) ) ); enableColors(); // fonts QFont fnt = font(); updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); fnt.setBold( true ); updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); enableFonts(); // layout sbMargin->setValue( config->readNumEntry( "ItemMargin", 0 ) ); sbSpacing->setValue( config->readNumEntry( "ItemSpacing", 10 ) ); sbSepWidth->setValue( config->readNumEntry( "SeparatorWidth", 2 ) ); cbDrawSeps->setChecked( config->readBoolEntry( "DrawSeparators", true ) ); cbDrawBorders->setChecked( config->readBoolEntry( "DrawBorder", true ) ); // behaviour cbShowFieldLabels->setChecked( config->readBoolEntry( "DrawFieldLabels", false ) ); cbShowEmptyFields->setChecked( config->readBoolEntry( "ShowEmptyFields", false ) ); } void CardViewLookNFeelPage::saveSettings( KConfig *config ) { // colors config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. { config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); config->writeEntry( "TextColor", lbColors->color( 1 ) ); config->writeEntry( "HeaderColor", lbColors->color( 2 ) ); config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); } // fonts config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); if ( cbEnableCustomFonts->isChecked() ) { config->writeEntry( "TextFont", lTextFont->font() ); config->writeEntry( "HeaderFont", lHeaderFont->font() ); } // layout config->writeEntry( "ItemMargin", sbMargin->value() ); config->writeEntry( "ItemSpacing", sbSpacing->value() ); config->writeEntry( "SeparatorWidth", sbSepWidth->value() ); config->writeEntry("DrawBorder", cbDrawBorders->isChecked()); config->writeEntry("DrawSeparators", cbDrawSeps->isChecked()); // behaviour config->writeEntry("DrawFieldLabels", cbShowFieldLabels->isChecked()); config->writeEntry("ShowEmptyFields", cbShowEmptyFields->isChecked()); } void CardViewLookNFeelPage::setTextFont() { QFont f( lTextFont->font() ); #ifndef KAB_EMBEDDED if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) updateFontLabel( f, lTextFont ); #else //KAB_EMBEDDED bool ok; QFont fout = KFontDialog::getFont( f, ok); if ( ok ) updateFontLabel( fout, lTextFont ); #endif //KAB_EMBEDDED } void CardViewLookNFeelPage::setHeaderFont() { QFont f( lHeaderFont->font() ); #ifndef KAB_EMBEDDED if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) updateFontLabel( f, lHeaderFont ); #else //KAB_EMBEDDED bool ok; QFont fout = KFontDialog::getFont( f, ok); if ( ok ) updateFontLabel( fout, lHeaderFont ); #endif //KAB_EMBEDDED } void CardViewLookNFeelPage::enableFonts() { vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); + if ( cbEnableCustomFonts->isChecked() ) + vbFonts->setFocus(); } void CardViewLookNFeelPage::enableColors() { lbColors->setEnabled( cbEnableCustomColors->isChecked() ); + if ( cbEnableCustomColors->isChecked() ) + lbColors->setFocus(); } void CardViewLookNFeelPage::initGUI() { int spacing = KDialog::spacingHint(); int margin = KDialog::marginHint(); QTabWidget *tabs = new QTabWidget( this ); // Layout QVBox *loTab = new QVBox( this, "layouttab" ); loTab->setSpacing( spacing ); loTab->setMargin( margin ); QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); QHBox *hbSW = new QHBox( gbGeneral ); QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); lSW->setBuddy( sbSepWidth); QHBox *hbPadding = new QHBox( gbGeneral ); QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); lSpacing->setBuddy( sbSpacing ); QGroupBox *gbCards = new QGroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); QHBox *hbMargin = new QHBox( gbCards ); QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); lMargin->setBuddy( sbMargin ); cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); loTab->setStretchFactor( new QWidget( loTab ), 1 ); QWhatsThis::add( sbMargin, i18n( "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " "incrementing the item margin will add space between the focus rectangle and the item data." ) ); QWhatsThis::add( lMargin, QWhatsThis::textFor( sbMargin ) ); QWhatsThis::add( sbSpacing, i18n( "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " "borders, other items or column separators." ) ); QWhatsThis::add( lSpacing, QWhatsThis::textFor( sbSpacing ) ); QWhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); QWhatsThis::add( lSW, QWhatsThis::textFor( sbSepWidth ) ); tabs->addTab( loTab, i18n("&Layout") ); // Colors QVBox *colorTab = new QVBox( this, "colortab" ); colorTab->setSpacing( spacing ); colorTab->setMargin( spacing ); cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); lbColors = new ColorListBox( colorTab ); tabs->addTab( colorTab, i18n("&Colors") ); QWhatsThis::add( cbEnableCustomColors, i18n( "If custom colors are enabled, you may choose the colors for the view below. " "Otherwise colors from your current KDE color scheme are used." ) ); QWhatsThis::add( lbColors, i18n( "Double click or press RETURN on a item to select a color for the related strings in the view." ) ); // Fonts QVBox *fntTab = new QVBox( this, "fonttab" ); fntTab->setSpacing( spacing ); fntTab->setMargin( spacing ); cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); vbFonts = new QWidget( fntTab ); QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); gFnts->setSpacing( spacing ); gFnts->setAutoAdd( true ); gFnts->setColStretch( 1, 1 ); QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); lTextFont = new QLabel( vbFonts ); lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); #ifndef KAB_EMBEDDED btnFont = new KPushButton( i18n("Choose..."), vbFonts ); #else //KAB_EMBEDDED btnFont = new QPushButton( i18n("Choose..."), vbFonts ); #endif //KAB_EMBEDDED lTFnt->setBuddy( btnFont ); diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp index 8bcceb2..0e36abd 100644 --- a/kaddressbook/views/configuretableviewdialog.cpp +++ b/kaddressbook/views/configuretableviewdialog.cpp @@ -117,197 +117,201 @@ qDebug("LookAndFeelPage::restoreSettings make base color configurable"); c = colorGroup().background(); lbColors->insertItem( new ColorListItem( i18n("Background Color"), config->readColorEntry( "BackgroundColor", &c ) ) ); c = colorGroup().foreground(); lbColors->insertItem( new ColorListItem( i18n("Text Color"), config->readColorEntry( "TextColor", &c ) ) ); c = colorGroup().button(); lbColors->insertItem( new ColorListItem( i18n("Header Background Color"), config->readColorEntry( "HeaderBackgroundColor", &c ) ) ); c = colorGroup().buttonText(); lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), config->readColorEntry( "HeaderTextColor", &c ) ) ); c = colorGroup().highlight(); lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), config->readColorEntry( "HighlightColor", &c ) ) ); c = colorGroup().highlightedText(); lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), config->readColorEntry( "HighlightedTextColor", &c ) ) ); c = colorGroup().background(); lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"), config->readColorEntry( "AlternatingBackgroundColor", &c ) ) ); enableColors(); // fonts QFont fnt = font(); updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); fnt.setBold( true ); updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); enableFonts(); } void LookAndFeelPage::saveSettings( KConfig *config ) { config->writeEntry("ABackground", mAlternateButton->isChecked()); config->writeEntry("SingleLine", mLineButton->isChecked()); config->writeEntry("ToolTips", mToolTipBox->isChecked()); config->writeEntry("Background", mBackgroundBox->isChecked()); config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text()); // colors config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. { config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); config->writeEntry( "TextColor", lbColors->color( 1 ) ); config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) ); config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) ); } // fonts config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); if ( cbEnableCustomFonts->isChecked() ) { config->writeEntry( "TextFont", lTextFont->font() ); config->writeEntry( "HeaderFont", lHeaderFont->font() ); } } void LookAndFeelPage::setTextFont() { QFont f( lTextFont->font() ); #ifndef KAB_EMBEDDED if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) updateFontLabel( f, lTextFont ); #else //KAB_EMBEDDED bool ok; QFont fout = KFontDialog::getFont( f, ok); if ( ok ) updateFontLabel( fout, lTextFont ); #endif //KAB_EMBEDDED } void LookAndFeelPage::setHeaderFont() { QFont f( lHeaderFont->font() ); #ifndef KAB_EMBEDDED if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) updateFontLabel( f, lHeaderFont ); #else //KAB_EMBEDDED bool ok; QFont fout = KFontDialog::getFont( f, ok); if ( ok ) updateFontLabel( fout, lHeaderFont ); #endif //KAB_EMBEDDED } void LookAndFeelPage::enableFonts() { vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); + if ( cbEnableCustomFonts->isChecked() ) + vbFonts->setFocus(); } void LookAndFeelPage::enableColors() { lbColors->setEnabled( cbEnableCustomColors->isChecked() ); + if ( cbEnableCustomColors->isChecked() ) + lbColors->setFocus(); } void LookAndFeelPage::initGUI() { int spacing = KDialog::spacingHint(); int margin = KDialog::marginHint(); QTabWidget *tabs = new QTabWidget( this ); // General QVBox *generalTab = new QVBox( this, "generaltab" ); generalTab->setSpacing( spacing ); generalTab->setMargin( margin ); QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, i18n("Row Separator"), generalTab); mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), group, "mAlternateButton"); mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab, "mBackgroundBox"); connect(mBackgroundBox, SIGNAL(toggled(bool)), SLOT(enableBackgroundToggled(bool))); // LR image not implemented mBackgroundBox->setEnabled( false ); mBackgroundName = new KURLRequester(generalTab, "mBackgroundName"); #ifndef KAB_EMBEDDED mBackgroundName->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading)); #endif //KAB_EMBEDDED // ToolTip Checkbox mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, "mToolTipBox"); tabs->addTab( generalTab, i18n("&General") ); // Colors QVBox *colorTab = new QVBox( this, "colortab" ); colorTab->setSpacing( spacing ); colorTab->setMargin( spacing ); cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); lbColors = new ColorListBox( colorTab ); tabs->addTab( colorTab, i18n("&Colors") ); QWhatsThis::add( cbEnableCustomColors, i18n( "If custom colors are enabled, you may choose the colors for the view below. " "Otherwise colors from your current KDE color scheme are used." ) ); QWhatsThis::add( lbColors, i18n( "Double click or press RETURN on a item to select a color for the related strings in the view." ) ); // Fonts QVBox *fntTab = new QVBox( this, "fonttab" ); fntTab->setSpacing( spacing ); fntTab->setMargin( spacing ); cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); vbFonts = new QWidget( fntTab ); QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); gFnts->setSpacing( spacing ); gFnts->setAutoAdd( true ); gFnts->setColStretch( 1, 1 ); QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); lTextFont = new QLabel( vbFonts ); lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); #ifndef KAB_EMBEDDED btnFont = new KPushButton( i18n("Choose..."), vbFonts ); #else //KAB_EMBEDDED btnFont = new QPushButton( i18n("Choose..."), vbFonts ); #endif //KAB_EMBEDDED lTFnt->setBuddy( btnFont ); connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); lHeaderFont = new QLabel( vbFonts ); lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); #ifndef KAB_EMBEDDED btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); #else //KAB_EMBEDDED btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); #endif //KAB_EMBEDDED lHFnt->setBuddy( btnHeaderFont ); connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); |