summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views
authorzautrix <zautrix>2005-04-02 12:16:34 (UTC)
committer zautrix <zautrix>2005-04-02 12:16:34 (UTC)
commit997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (patch) (unidiff)
treef788b37459574b5cea0d2ab874882c6a396c240d /kaddressbook/views
parente0d51120d2f0c178115746e0c1357af40f95bc77 (diff)
downloadkdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.zip
kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.gz
kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.bz2
more fixes
Diffstat (limited to 'kaddressbook/views') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/colorlistbox.cpp7
-rw-r--r--kaddressbook/views/colorlistbox.h1
-rw-r--r--kaddressbook/views/configurecardviewdialog.cpp4
-rw-r--r--kaddressbook/views/configuretableviewdialog.cpp6
4 files changed, 16 insertions, 2 deletions
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
@@ -11,91 +11,96 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * 18 *
19 */ 19 */
20 20
21#include <qpainter.h> 21#include <qpainter.h>
22 22
23#include <kcolordialog.h> 23#include <kcolordialog.h>
24 24
25#ifndef KAB_EMBEDDED 25#ifndef KAB_EMBEDDED
26#include <kcolordrag.h> 26#include <kcolordrag.h>
27#endif //KAB_EMBEDDED 27#endif //KAB_EMBEDDED
28 28
29#include "colorlistbox.h" 29#include "colorlistbox.h"
30 30
31ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f ) 31ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f )
32 :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) 32 :KListBox( parent, name, f ), mCurrentOnDragEnter(-1)
33{ 33{
34 connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); 34 connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) );
35 connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) );
35 setAcceptDrops( true); 36 setAcceptDrops( true);
36} 37}
37 38
38 39
39void ColorListBox::setEnabled( bool state ) 40void ColorListBox::setEnabled( bool state )
40{ 41{
41 if( state == isEnabled() ) 42 if( state == isEnabled() )
42 { 43 {
43 return; 44 return;
44 } 45 }
45 46
46 QListBox::setEnabled( state ); 47 QListBox::setEnabled( state );
47 for( uint i=0; i<count(); i++ ) 48 for( uint i=0; i<count(); i++ )
48 { 49 {
49 updateItem( i ); 50 updateItem( i );
50 } 51 }
51} 52}
52 53
53 54
54void ColorListBox::setColor( uint index, const QColor &color ) 55void ColorListBox::setColor( uint index, const QColor &color )
55{ 56{
56 if( index < count() ) 57 if( index < count() )
57 { 58 {
58 ColorListItem *colorItem = (ColorListItem*)item(index); 59 ColorListItem *colorItem = (ColorListItem*)item(index);
59 colorItem->setColor(color); 60 colorItem->setColor(color);
60 updateItem( colorItem ); 61 updateItem( colorItem );
61 } 62 }
62} 63}
63 64
64 65
65QColor ColorListBox::color( uint index ) const 66QColor ColorListBox::color( uint index ) const
66{ 67{
67 if( index < count() ) 68 if( index < count() )
68 { 69 {
69 ColorListItem *colorItem = (ColorListItem*)item(index); 70 ColorListItem *colorItem = (ColorListItem*)item(index);
70 return( colorItem->color() ); 71 return( colorItem->color() );
71 } 72 }
72 else 73 else
73 { 74 {
74 return( black ); 75 return( black );
75 } 76 }
76} 77}
77 78void ColorListBox::slotNewColor(QListBoxItem * i)
79{
80 if ( i )
81 newColor( index( i ) );
82}
78 83
79void ColorListBox::newColor( int index ) 84void ColorListBox::newColor( int index )
80{ 85{
81 if( isEnabled() == false ) 86 if( isEnabled() == false )
82 { 87 {
83 return; 88 return;
84 } 89 }
85 90
86 if( (uint)index < count() ) 91 if( (uint)index < count() )
87 { 92 {
88 QColor c = color( index ); 93 QColor c = color( index );
89#ifndef KAB_EMBEDDED 94#ifndef KAB_EMBEDDED
90 if( KColorDialog::getColor( c, this ) != QDialog::Rejected ) 95 if( KColorDialog::getColor( c, this ) != QDialog::Rejected )
91 { 96 {
92 setColor( index, c ); 97 setColor( index, c );
93 } 98 }
94#else //KAB_EMBEDDED 99#else //KAB_EMBEDDED
95 KColorDialog* k = new KColorDialog( this ); 100 KColorDialog* k = new KColorDialog( this );
96 k->setColor( c ); 101 k->setColor( c );
97 int res = k->exec(); 102 int res = k->exec();
98 if ( res ) { 103 if ( res ) {
99 setColor( index, k->getColor() ); 104 setColor( index, k->getColor() );
100 } 105 }
101 delete k; 106 delete k;
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
@@ -27,48 +27,49 @@ class QDragEnterEvent;
27class QDragLeaveEvent; 27class QDragLeaveEvent;
28class QDragMoveEvent; 28class QDragMoveEvent;
29class QDropEvent; 29class QDropEvent;
30 30
31class ColorListBox : public KListBox 31class ColorListBox : public KListBox
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35 public: 35 public:
36 ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 ); 36 ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 );
37 void setColor( uint index, const QColor &color ); 37 void setColor( uint index, const QColor &color );
38 QColor color( uint index ) const; 38 QColor color( uint index ) const;
39 39
40 public slots: 40 public slots:
41 virtual void setEnabled( bool state ); 41 virtual void setEnabled( bool state );
42 42
43 protected: 43 protected:
44 void dragEnterEvent( QDragEnterEvent *e ); 44 void dragEnterEvent( QDragEnterEvent *e );
45 void dragLeaveEvent( QDragLeaveEvent *e ); 45 void dragLeaveEvent( QDragLeaveEvent *e );
46 void dragMoveEvent( QDragMoveEvent *e ); 46 void dragMoveEvent( QDragMoveEvent *e );
47 void dropEvent( QDropEvent *e ); 47 void dropEvent( QDropEvent *e );
48 48
49 private slots: 49 private slots:
50 void newColor( int index ); 50 void newColor( int index );
51 void slotNewColor(QListBoxItem * i);
51 52
52 private: 53 private:
53 int mCurrentOnDragEnter; 54 int mCurrentOnDragEnter;
54 55
55}; 56};
56 57
57 58
58class ColorListItem : public QListBoxItem 59class ColorListItem : public QListBoxItem
59{ 60{
60 public: 61 public:
61 ColorListItem( const QString &text, const QColor &color=Qt::black ); 62 ColorListItem( const QString &text, const QColor &color=Qt::black );
62 const QColor &color( void ); 63 const QColor &color( void );
63 void setColor( const QColor &color ); 64 void setColor( const QColor &color );
64 65
65 protected: 66 protected:
66 virtual void paint( QPainter * ); 67 virtual void paint( QPainter * );
67 virtual int height( const QListBox * ) const; 68 virtual int height( const QListBox * ) const;
68 virtual int width( const QListBox * ) const; 69 virtual int width( const QListBox * ) const;
69 70
70 private: 71 private:
71 QColor mColor; 72 QColor mColor;
72 int mBoxWidth; 73 int mBoxWidth;
73}; 74};
74 75
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
@@ -194,53 +194,57 @@ void CardViewLookNFeelPage::setTextFont()
194 bool ok; 194 bool ok;
195 QFont fout = KFontDialog::getFont( f, ok); 195 QFont fout = KFontDialog::getFont( f, ok);
196 if ( ok ) 196 if ( ok )
197 updateFontLabel( fout, lTextFont ); 197 updateFontLabel( fout, lTextFont );
198#endif //KAB_EMBEDDED 198#endif //KAB_EMBEDDED
199} 199}
200 200
201void CardViewLookNFeelPage::setHeaderFont() 201void CardViewLookNFeelPage::setHeaderFont()
202{ 202{
203 QFont f( lHeaderFont->font() ); 203 QFont f( lHeaderFont->font() );
204#ifndef KAB_EMBEDDED 204#ifndef KAB_EMBEDDED
205 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) 205 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
206 updateFontLabel( f, lHeaderFont ); 206 updateFontLabel( f, lHeaderFont );
207#else //KAB_EMBEDDED 207#else //KAB_EMBEDDED
208 bool ok; 208 bool ok;
209 QFont fout = KFontDialog::getFont( f, ok); 209 QFont fout = KFontDialog::getFont( f, ok);
210 if ( ok ) 210 if ( ok )
211 updateFontLabel( fout, lHeaderFont ); 211 updateFontLabel( fout, lHeaderFont );
212#endif //KAB_EMBEDDED 212#endif //KAB_EMBEDDED
213} 213}
214 214
215void CardViewLookNFeelPage::enableFonts() 215void CardViewLookNFeelPage::enableFonts()
216{ 216{
217 vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); 217 vbFonts->setEnabled( cbEnableCustomFonts->isChecked() );
218 if ( cbEnableCustomFonts->isChecked() )
219 vbFonts->setFocus();
218} 220}
219 221
220void CardViewLookNFeelPage::enableColors() 222void CardViewLookNFeelPage::enableColors()
221{ 223{
222 lbColors->setEnabled( cbEnableCustomColors->isChecked() ); 224 lbColors->setEnabled( cbEnableCustomColors->isChecked() );
225 if ( cbEnableCustomColors->isChecked() )
226 lbColors->setFocus();
223} 227}
224 228
225void CardViewLookNFeelPage::initGUI() 229void CardViewLookNFeelPage::initGUI()
226{ 230{
227 int spacing = KDialog::spacingHint(); 231 int spacing = KDialog::spacingHint();
228 int margin = KDialog::marginHint(); 232 int margin = KDialog::marginHint();
229 233
230 QTabWidget *tabs = new QTabWidget( this ); 234 QTabWidget *tabs = new QTabWidget( this );
231 235
232 // Layout 236 // Layout
233 QVBox *loTab = new QVBox( this, "layouttab" ); 237 QVBox *loTab = new QVBox( this, "layouttab" );
234 238
235 loTab->setSpacing( spacing ); 239 loTab->setSpacing( spacing );
236 loTab->setMargin( margin ); 240 loTab->setMargin( margin );
237 241
238 QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); 242 QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab );
239 243
240 cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); 244 cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral );
241 245
242 QHBox *hbSW = new QHBox( gbGeneral ); 246 QHBox *hbSW = new QHBox( gbGeneral );
243 QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); 247 QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW );
244 sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); 248 sbSepWidth = new QSpinBox( 1, 50, 1, hbSW );
245 lSW->setBuddy( sbSepWidth); 249 lSW->setBuddy( sbSepWidth);
246 250
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
@@ -189,53 +189,57 @@ void LookAndFeelPage::setTextFont()
189 bool ok; 189 bool ok;
190 QFont fout = KFontDialog::getFont( f, ok); 190 QFont fout = KFontDialog::getFont( f, ok);
191 if ( ok ) 191 if ( ok )
192 updateFontLabel( fout, lTextFont ); 192 updateFontLabel( fout, lTextFont );
193#endif //KAB_EMBEDDED 193#endif //KAB_EMBEDDED
194} 194}
195 195
196void LookAndFeelPage::setHeaderFont() 196void LookAndFeelPage::setHeaderFont()
197{ 197{
198 QFont f( lHeaderFont->font() ); 198 QFont f( lHeaderFont->font() );
199#ifndef KAB_EMBEDDED 199#ifndef KAB_EMBEDDED
200 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) 200 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
201 updateFontLabel( f, lHeaderFont ); 201 updateFontLabel( f, lHeaderFont );
202#else //KAB_EMBEDDED 202#else //KAB_EMBEDDED
203 bool ok; 203 bool ok;
204 QFont fout = KFontDialog::getFont( f, ok); 204 QFont fout = KFontDialog::getFont( f, ok);
205 if ( ok ) 205 if ( ok )
206 updateFontLabel( fout, lHeaderFont ); 206 updateFontLabel( fout, lHeaderFont );
207#endif //KAB_EMBEDDED 207#endif //KAB_EMBEDDED
208} 208}
209 209
210void LookAndFeelPage::enableFonts() 210void LookAndFeelPage::enableFonts()
211{ 211{
212 vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); 212 vbFonts->setEnabled( cbEnableCustomFonts->isChecked() );
213 if ( cbEnableCustomFonts->isChecked() )
214 vbFonts->setFocus();
213} 215}
214 216
215void LookAndFeelPage::enableColors() 217void LookAndFeelPage::enableColors()
216{ 218{
217 lbColors->setEnabled( cbEnableCustomColors->isChecked() ); 219 lbColors->setEnabled( cbEnableCustomColors->isChecked() );
220 if ( cbEnableCustomColors->isChecked() )
221 lbColors->setFocus();
218} 222}
219 223
220void LookAndFeelPage::initGUI() 224void LookAndFeelPage::initGUI()
221{ 225{
222 int spacing = KDialog::spacingHint(); 226 int spacing = KDialog::spacingHint();
223 int margin = KDialog::marginHint(); 227 int margin = KDialog::marginHint();
224 228
225 QTabWidget *tabs = new QTabWidget( this ); 229 QTabWidget *tabs = new QTabWidget( this );
226 230
227 // General 231 // General
228 QVBox *generalTab = new QVBox( this, "generaltab" ); 232 QVBox *generalTab = new QVBox( this, "generaltab" );
229 233
230 generalTab->setSpacing( spacing ); 234 generalTab->setSpacing( spacing );
231 generalTab->setMargin( margin ); 235 generalTab->setMargin( margin );
232 236
233 QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, 237 QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal,
234 i18n("Row Separator"), generalTab); 238 i18n("Row Separator"), generalTab);
235 239
236 mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), 240 mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"),
237 group, "mAlternateButton"); 241 group, "mAlternateButton");
238 mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); 242 mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton");
239 mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); 243 mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton");
240 244
241 mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab, 245 mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab,