-rw-r--r-- | core/pim/addressbook/abconfig.cpp | 14 | ||||
-rw-r--r-- | core/pim/addressbook/abconfig.h | 3 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 32 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 5 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg_base.ui | 61 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 2 |
6 files changed, 101 insertions, 16 deletions
diff --git a/core/pim/addressbook/abconfig.cpp b/core/pim/addressbook/abconfig.cpp index e58fa76..0b61614 100644 --- a/core/pim/addressbook/abconfig.cpp +++ b/core/pim/addressbook/abconfig.cpp @@ -1,184 +1,198 @@ #include "abconfig.h" #include "version.h" #include <qpe/config.h> #include <qpe/recordfields.h> AbConfig::AbConfig( ): m_useQtMail( true ), m_useOpieMail( false ), m_useRegExp( false ), m_beCaseSensitive( false ), m_fontSize( 1 ), m_barPos( QMainWindow::Top ), + m_fixedBars( true ), m_changed( false ) { } AbConfig::~AbConfig() { } bool AbConfig::useRegExp() const { return m_useRegExp; } bool AbConfig::useWildCards() const { return !m_useRegExp; } bool AbConfig::useQtMail() const { return m_useQtMail; } bool AbConfig::useOpieMail() const { return m_useOpieMail; } bool AbConfig::beCaseSensitive() const { return m_beCaseSensitive; } int AbConfig::fontSize() const { return m_fontSize; } QValueList<int> AbConfig::orderList() const { return m_ordered; } QMainWindow::ToolBarDock AbConfig::getToolBarPos() const { return (QMainWindow::ToolBarDock) m_barPos; } +bool AbConfig::fixedBars() const +{ + return m_fixedBars; +} void AbConfig::setUseRegExp( bool v ) { m_useRegExp = v ; m_changed = true; } void AbConfig::setUseWildCards( bool v ) { m_useRegExp = !v; m_changed = true; } void AbConfig::setBeCaseSensitive( bool v ) { m_beCaseSensitive = v; m_changed = true; } void AbConfig::setUseQtMail( bool v ) { m_useQtMail = v; m_changed = true; } void AbConfig::setUseOpieMail( bool v ) { m_useOpieMail = v; m_changed = true; } void AbConfig::setFontSize( int v ) { m_fontSize = v; m_changed = true; } void AbConfig::setOrderList( const QValueList<int>& list ) { m_ordered = list; m_changed = true; } void AbConfig::setToolBarDock( const QMainWindow::ToolBarDock v ) { m_barPos = v; m_changed = true; } +void AbConfig::setFixedBars( const bool fixed ) +{ + m_fixedBars = fixed; + m_changed = true; +} + void AbConfig::load() { // Read Config settings Config cfg("AddressBook"); cfg.setGroup("Font"); m_fontSize = cfg.readNumEntry( "fontSize", 1 ); cfg.setGroup("Search"); m_useRegExp = cfg.readBoolEntry( "useRegExp" ); m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive" ); cfg.setGroup("Mail"); m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); cfg.setGroup("ContactOrder"); int ID = 0; int i = 0; ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); while ( ID != 0 ){ m_ordered.append( ID ); ID = cfg.readNumEntry( "ContactID_"+QString::number(i++), 0 ); } // If no contact order is defined, we set the default if ( m_ordered.count() == 0 ) { m_ordered.append( Qtopia::DefaultEmail ); m_ordered.append( Qtopia::HomePhone); m_ordered.append( Qtopia::HomeMobile); m_ordered.append( Qtopia::BusinessPhone); } cfg.setGroup("ToolBar"); m_barPos = cfg.readNumEntry( "Position", QMainWindow::Top ); + m_fixedBars= cfg.readBoolEntry( "fixedBars", true ); m_changed = false; } void AbConfig::save() { if ( m_changed ){ Config cfg("AddressBook"); cfg.setGroup("Font"); cfg.writeEntry("fontSize", m_fontSize); cfg.setGroup("Search"); cfg.writeEntry("useRegExp", m_useRegExp); cfg.writeEntry("caseSensitive", m_beCaseSensitive); cfg.setGroup("Mail"); cfg.writeEntry( "useQtMail", m_useQtMail ); cfg.writeEntry( "useOpieMail", m_useOpieMail); cfg.setGroup("ContactOrder"); cfg.clearGroup(); for ( uint i = 0; i < m_ordered.count(); i++ ){ cfg.writeEntry( "ContactID_"+QString::number(i), m_ordered[i] ); } cfg.setGroup("ToolBar"); cfg.writeEntry( "Position", m_barPos ); + cfg.writeEntry( "fixedBars", m_fixedBars ); cfg.setGroup("Version"); cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); cfg.writeEntry( "Mainversion", MAINVERSION ); cfg.writeEntry( "SubVersion", SUBVERSION ); cfg.writeEntry( "PatchVersion", PATCHVERSION ); } } void AbConfig::operator= ( const AbConfig& cnf ) { m_useQtMail = cnf.m_useQtMail; m_useOpieMail = cnf.m_useOpieMail; m_useRegExp = cnf.m_useRegExp; m_beCaseSensitive = cnf.m_beCaseSensitive; m_fontSize = cnf.m_fontSize; m_ordered = cnf.m_ordered; m_barPos = cnf.m_barPos; + m_fixedBars = cnf.m_fixedBars; } diff --git a/core/pim/addressbook/abconfig.h b/core/pim/addressbook/abconfig.h index b8460d7..ce51b4c 100644 --- a/core/pim/addressbook/abconfig.h +++ b/core/pim/addressbook/abconfig.h @@ -1,55 +1,58 @@ #ifndef _ABCONFIG_H_ #define _ABCONFIG_H_ #include <qstringlist.h> #include <qmainwindow.h> class AbConfig { public: AbConfig(); ~AbConfig(); // Search Settings bool useRegExp() const; bool useWildCards() const; bool beCaseSensitive() const; bool useQtMail() const; bool useOpieMail() const; int fontSize() const; QValueList<int> orderList() const; QMainWindow::ToolBarDock getToolBarPos() const; + bool fixedBars() const; void setUseRegExp( bool v ); void setUseWildCards( bool v ); void setBeCaseSensitive( bool v ); void setUseQtMail( bool v ); void setUseOpieMail( bool v ); void setFontSize( int v ); void setOrderList( const QValueList<int>& list ); void setToolBarDock( const QMainWindow::ToolBarDock v ); + void setFixedBars( const bool fixed ); void operator= ( const AbConfig& cnf ); void load(); void save(); protected: /* virtual void itemUp(); */ /* virtual void itemDown(); */ QStringList contFields; bool m_useQtMail; bool m_useOpieMail; bool m_useRegExp; bool m_beCaseSensitive; int m_fontSize; QValueList<int> m_ordered; int m_barPos; + bool m_fixedBars; bool m_changed; }; #endif diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 14e5b3f..a5bf19b 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -42,111 +42,120 @@ // #include <qtoolbar.h> // #include <qmenubar.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qaction.h> #include <qdialog.h> #include <qdir.h> #include <qfile.h> #include <qimage.h> #include <qlayout.h> #include <qmessagebox.h> #include <qpixmap.h> #include <qpopupmenu.h> #include <qstringlist.h> #include <qtoolbutton.h> #include <qwhatsthis.h> #include <qdatetime.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include "picker.h" #include "configdlg.h" extern QString addressbookPersonalVCardName(); AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), catMenu (0l), abEditor(0l), syncing(FALSE), m_tableViewButton(0l), m_cardViewButton(0l) { isLoading = true; m_config.load(); setCaption( tr("Contacts") ); setIcon( Resource::loadPixmap( "AddressBook" ) ); // Settings for Main Menu - setToolBarsMovable( true ); + // setToolBarsMovable( false ); + setToolBarsMovable( !m_config.fixedBars() ); setRightJustification( true ); - // Create Toolbar - listTools = new QPEToolBar( this, "list operations" ); - listTools->setHorizontalStretchable( true ); - addToolBar( listTools ); - moveToolBar( listTools, m_config.getToolBarPos() ); + QPEToolBar *bar = new QPEToolBar( this ); + bar->setHorizontalStretchable( TRUE ); - QPEMenuBar *mbList = new QPEMenuBar( this ); + QPEMenuBar *mbList = new QPEMenuBar( bar ); mbList->setMargin( 0 ); QPopupMenu *edit = new QPopupMenu( mbList ); mbList->insertItem( tr( "Contact" ), edit ); + // Category Menu + catMenu = new QPopupMenu( this ); + catMenu->setCheckable( TRUE ); + connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); + mbList->insertItem( tr("View"), catMenu ); + + // Create Toolbar + listTools = new QPEToolBar( this, "list operations" ); + listTools->setHorizontalStretchable( true ); + addToolBar( listTools ); + moveToolBar( listTools, m_config.getToolBarPos() ); // View Icons m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), QString::null, 0, this, 0 ); connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); m_tableViewButton->setToggleAction( true ); m_tableViewButton->addTo( listTools ); m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); m_cardViewButton->setToggleAction( true ); m_cardViewButton->addTo( listTools ); listTools->addSeparator(); // Other Buttons QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); actionNew = a; connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); a->addTo( edit ); a->addTo( listTools ); a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); actionEdit = a; connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); a->addTo( edit ); a->addTo( listTools ); a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); actionTrash = a; connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); a->addTo( edit ); a->addTo( listTools ); // make it possible to go directly to businesscard via qcop call //#if defined(Q_WS_QWS) // Why this ? (se) #if !defined(QT_NO_COP) QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); #endif // #endif a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); actionFind = a; @@ -198,104 +207,101 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 0, this, 0); actionPersonal = a; connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); a->addTo( edit ); edit->insertSeparator(); a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), QString::null, 0, this, 0 , TRUE ); actionPersonal = a; connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); a->addTo( edit ); #ifdef __DEBUG_RELEASE // Remove this function for public Release ! This is only // for debug purposes .. a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); a->addTo( edit ); #endif a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); a->addTo( edit ); // Create Views listContainer = new QWidget( this ); QVBoxLayout *vb = new QVBoxLayout( listContainer ); m_abView = new AbView( listContainer, m_config.orderList() ); vb->addWidget( m_abView ); // abList->setHScrollBarMode( QScrollView::AlwaysOff ); connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), this, SLOT( slotViewSwitched( int ) ) ); QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); m_abView->load(); // Letter Picker pLabel = new LetterPicker( listContainer ); connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); vb->addWidget( pLabel ); - // Category Menu - catMenu = new QPopupMenu( this ); - catMenu->setCheckable( TRUE ); - connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); + // All Categories into view-menu.. populateCategories(); - mbList->insertItem( tr("View"), catMenu ); - defaultFont = new QFont( m_abView->font() ); + // Fontsize + defaultFont = new QFont( m_abView->font() ); slotSetFont(m_config.fontSize()); m_curFontSize = m_config.fontSize(); setCentralWidget(listContainer); // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); isLoading = false; } void AddressbookWindow::slotConfig() { ConfigDlg* dlg = new ConfigDlg( this, "Config" ); dlg -> setConfig( m_config ); dlg -> showMaximized(); if ( dlg -> exec() ) { qWarning ("Config Dialog accepted!"); m_config = dlg -> getConfig(); if ( m_curFontSize != m_config.fontSize() ){ qWarning("Font was changed!"); m_curFontSize = m_config.fontSize(); emit slotSetFont( m_curFontSize ); } m_abView -> setListOrder( m_config.orderList() ); } delete dlg; } void AddressbookWindow::slotSetFont( int size ) { qWarning("void AddressbookWindow::slotSetFont( %d )", size); if (size > 2 || size < 0) size = 1; m_config.setFontSize( size ); QFont *currentFont; switch (size) { case 0: m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); currentFont = new QFont (m_abView->font()); // abList->resizeRows(currentFont->pixelSize() + 7); :SX diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index f2f4141..629feef 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp @@ -77,75 +77,78 @@ void ConfigDlg::slotItemAdd() QString item = allFieldListBox->currentText(); qWarning("ADding %s", item.latin1()); fieldListBox->insertItem( item ); } } void ConfigDlg::slotItemRemove() { qWarning( "void ConfigDlg::slotItemRemove()" ); int i = fieldListBox->currentItem(); if ( i > 0 ) { fieldListBox->removeItem( i ); } } void ConfigDlg::setConfig( const AbConfig& cnf ) { 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; } for( uint i = 0; i < m_config.orderList().count(); i++ ) { fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); } - + m_fixedBars->setChecked( m_config.fixedBars() ); + m_moveBars->setChecked( !m_config.fixedBars() ); } 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 ); + m_config.setFixedBars( m_fixedBars->isChecked() ); + return m_config; } diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui index 308e138..1b5ac17 100644 --- a/core/pim/addressbook/configdlg_base.ui +++ b/core/pim/addressbook/configdlg_base.ui @@ -35,97 +35,97 @@ <property> <name>layoutMargin</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>1</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>configDlg_base</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>7</vsizetype> </sizepolicy> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <property> <name>whatsThis</name> <string>Click on tab to select one</string> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>Widget5</cstring> </property> <attribute> <name>title</name> <string>Misc</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> - <number>5</number> + <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>GroupBox2</cstring> </property> <property stdset="1"> <name>title</name> <string>Search Settings</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QButtonGroup</class> <property stdset="1"> <name>name</name> <cstring>ButtonGroup1</cstring> </property> <property stdset="1"> <name>title</name> <string>Query Style</string> </property> <property> <name>whatsThis</name> <string>Settings for the search query style</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> @@ -210,96 +210,155 @@ <name>name</name> <cstring>m_smallFont</cstring> </property> <property stdset="1"> <name>text</name> <string>Small</string> </property> <property> <name>whatsThis</name> <string>Font size for list- and card view</string> </property> </widget> <widget> <class>QRadioButton</class> <property stdset="1"> <name>name</name> <cstring>m_normalFont</cstring> </property> <property stdset="1"> <name>text</name> <string>Normal</string> </property> <property stdset="1"> <name>checked</name> <bool>true</bool> </property> <property> <name>whatsThis</name> <string>Font size for list- and card view</string> </property> </widget> <widget> <class>QRadioButton</class> <property stdset="1"> <name>name</name> <cstring>m_largeFont</cstring> </property> <property stdset="1"> <name>text</name> <string>Large</string> </property> <property> <name>whatsThis</name> <string>Font size for list- and card view</string> </property> </widget> </hbox> </widget> + <widget> + <class>QButtonGroup</class> + <property stdset="1"> + <name>name</name> + <cstring>ButtonGroup4</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Tool-/Menubar</string> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QRadioButton</class> + <property stdset="1"> + <name>name</name> + <cstring>m_fixedBars</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Fixed</string> + </property> + <property stdset="1"> + <name>checked</name> + <bool>true</bool> + </property> + <property> + <name>toolTip</name> + <string></string> + </property> + <property> + <name>whatsThis</name> + <string>Switch to fixed menu-/toolbars after restarting application !</string> + </property> + </widget> + <widget> + <class>QRadioButton</class> + <property stdset="1"> + <name>name</name> + <cstring>m_moveBars</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Movable</string> + </property> + <property> + <name>whatsThis</name> + <string>Switch to moveable menu-/toolbars after restarting application !</string> + </property> + </widget> + </hbox> + </widget> <spacer> <property> <name>name</name> <cstring>Spacer3</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Mail</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> <number>5</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QButtonGroup</class> <property stdset="1"> <name>name</name> <cstring>ButtonGroup2</cstring> </property> diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index 999ce67..d590a86 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h @@ -1,10 +1,10 @@ #ifndef _VERSION_H_ #define _VERSION_H_ #define MAINVERSION "0" #define SUBVERSION "9" -#define PATCHVERSION "2" +#define PATCHVERSION "3" #define APPNAME "OPIE_ADDRESSBOOK" #endif |