author | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
commit | 8401def65aa4f19d91873bc57a3dcf25c358c490 (patch) (side-by-side diff) | |
tree | 3e64bd2d1b6f92c77304cc2d2c0fd06b07d718e5 /core/pim/addressbook/configdlg.cpp | |
parent | 4d0773414a0fb59e53f30d4d2363f73304f474dc (diff) | |
download | opie-8401def65aa4f19d91873bc57a3dcf25c358c490.zip opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.gz opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.bz2 |
Back to main tree. Back to main tree.
Back to main tree. Waiting for moving to feature freeze ..
Diffstat (limited to 'core/pim/addressbook/configdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 140 |
1 files changed, 108 insertions, 32 deletions
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index d1c2ef8..afba688 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp @@ -1,4 +1,9 @@ #include "configdlg.h" +#include "ocontactfields.h" #include <qcheckbox.h> #include <qradiobutton.h> +#include <qlistbox.h> +#include <qpushbutton.h> + +#include <opie/ocontact.h> @@ -6,56 +11,127 @@ ConfigDlg::ConfigDlg( QWidget *parent, const char *name): ConfigDlg_Base(parent, name, true ) -{} +{ + contFields = OContactFields::trfields(); + // We add all Fields into the Listbox + for (uint i=0; i < contFields.count(); i++) { + allFieldListBox->insertItem( contFields[i] ); + } -bool ConfigDlg::useRegExp() const -{ - return m_useRegExp->isOn(); + // Get the translation maps between Field ID and translated strings + m_mapStrToID = OContactFields::trFieldsToId(); + m_mapIDToStr = OContactFields::idToTrFields(); + + connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); + connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); + connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); + connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); } -bool ConfigDlg::useWildCards() const + +void ConfigDlg::slotItemUp() { - return m_useWildCard->isOn(); + qWarning( "void ConfigDlg::slotItemUp()" ); + + int i = fieldListBox->currentItem(); + if ( i > 0 ) { + QString item = fieldListBox->currentText(); + fieldListBox->removeItem( i ); + fieldListBox->insertItem( item, i-1 ); + fieldListBox->setCurrentItem( i-1 ); } -bool ConfigDlg::useQtMail() const -{ - return m_useQtMail->isOn(); + } -bool ConfigDlg::useOpieMail() const + +void ConfigDlg::slotItemDown() { - return m_useOpieMail->isOn(); + qWarning( "void ConfigDlg::slotItemDown()" ); + + int i = fieldListBox->currentItem(); + if ( i < (int)fieldListBox->count() - 1 ) { + QString item = fieldListBox->currentText(); + fieldListBox->removeItem( i ); + fieldListBox->insertItem( item, i+1 ); + fieldListBox->setCurrentItem( i+1 ); } -bool ConfigDlg::beCaseSensitive() const -{ - return m_useCaseSensitive->isChecked(); } -bool ConfigDlg::signalWrapAround() const + +void ConfigDlg::slotItemAdd() { - return m_signalWrapAround->isChecked(); + qWarning( "void ConfigDlg::slotItemAdd()" ); + + int i = allFieldListBox->currentItem(); + if ( i > 0 ) { + QString item = allFieldListBox->currentText(); + qWarning("ADding %s", item.latin1()); + fieldListBox->insertItem( item ); } -void ConfigDlg::setUseRegExp( bool v ) -{ - m_useRegExp->setChecked( v ); } -void ConfigDlg::setUseWildCards( bool v ) + +void ConfigDlg::slotItemRemove() { - m_useWildCard->setChecked( v ); + qWarning( "void ConfigDlg::slotItemRemove()" ); + + int i = fieldListBox->currentItem(); + if ( i > 0 ) { + fieldListBox->removeItem( i ); } -void ConfigDlg::setBeCaseSensitive( bool v ) -{ - m_useCaseSensitive->setChecked( v ); } -void ConfigDlg::setSignalWrapAround( bool v ) + +void ConfigDlg::setConfig( const AbConfig& cnf ) { - m_signalWrapAround->setChecked( v ); + m_config = cnf; + + m_useRegExp->setChecked( m_config.useRegExp() ); + m_useWildCard->setChecked( m_config.useWildCards() ); + m_useQtMail->setChecked( m_config.useQtMail() ); + m_useOpieMail->setChecked( m_config.useOpieMail() ); + m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); + + switch( m_config.fontSize() ){ + case 0: + m_smallFont->setChecked( true ); + m_normalFont->setChecked( false ); + m_largeFont->setChecked( false ); + break; + case 1: + m_smallFont->setChecked( false ); + m_normalFont->setChecked( true ); + m_largeFont->setChecked( false ); + break; + case 2: + m_smallFont->setChecked( false ); + m_normalFont->setChecked( false ); + m_largeFont->setChecked( true ); + break; } -void ConfigDlg::setQtMail( bool v ) -{ - m_useQtMail->setChecked( v ); + + for( uint i = 0; i < m_config.orderList().count(); i++ ) { + fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); } -void ConfigDlg::setOpieMail( bool v ) -{ - m_useOpieMail->setChecked( v ); + + } +AbConfig ConfigDlg::getConfig() +{ + m_config.setUseRegExp( m_useRegExp->isOn() ); + m_config.setUseWildCards( m_useWildCard->isOn() ); + m_config.setUseQtMail( m_useQtMail->isOn() ); + m_config.setUseOpieMail( m_useOpieMail->isOn() ); + m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); + if ( m_smallFont->isChecked() ) + m_config.setFontSize( 0 ); + if ( m_normalFont->isChecked() ) + m_config.setFontSize( 1 ); + if ( m_largeFont->isChecked() ) + m_config.setFontSize( 2 ); + QValueList<int> orderlist; + for( int i = 0; i < (int)fieldListBox->count(); i++ ) { + orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); + } + m_config.setOrderList( orderlist ); + + return m_config; +} |