Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 5a8038b..b7b35bc 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -215,4 +215,48 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
215 | 215 | ||
216 | fontMenu = new QPopupMenu(this); | ||
217 | fontMenu->setCheckable( true ); | ||
218 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | ||
219 | |||
220 | fontMenu->insertItem("Small", 0); | ||
221 | fontMenu->insertItem("Normal", 1); | ||
222 | fontMenu->insertItem("Large", 2); | ||
223 | |||
224 | defaultFont = new QFont( abList->font() ); | ||
225 | |||
226 | slotSetFont(startFontSize); | ||
227 | |||
228 | mbList->insertItem( tr("Font"), fontMenu); | ||
229 | setCentralWidget(abList); | ||
230 | |||
216 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 231 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
217 | } | 232 | } |
233 | void AddressbookWindow::slotSetFont( int size ) { | ||
234 | |||
235 | if (size > 2 || size < 0) | ||
236 | size = 1; | ||
237 | |||
238 | startFontSize = size; | ||
239 | |||
240 | switch (size) { | ||
241 | case 0: | ||
242 | fontMenu->setItemChecked(0, true); | ||
243 | fontMenu->setItemChecked(1, false); | ||
244 | fontMenu->setItemChecked(2, false); | ||
245 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | ||
246 | break; | ||
247 | case 1: | ||
248 | fontMenu->setItemChecked(0, false); | ||
249 | fontMenu->setItemChecked(1, true); | ||
250 | fontMenu->setItemChecked(2, false); | ||
251 | abList->setFont( *defaultFont ); | ||
252 | break; | ||
253 | case 2: | ||
254 | fontMenu->setItemChecked(0, false); | ||
255 | fontMenu->setItemChecked(1, false); | ||
256 | fontMenu->setItemChecked(2, true); | ||
257 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | |||
218 | 262 | ||
@@ -246,2 +290,5 @@ AddressbookWindow::~AddressbookWindow() | |||
246 | { | 290 | { |
291 | Config cfg("AddressBook"); | ||
292 | cfg.setGroup("Font"); | ||
293 | cfg.writeEntry("fontSize", startFontSize); | ||
247 | } | 294 | } |
@@ -715,2 +762,4 @@ void AddressbookWindow::initFields() | |||
715 | i = 0; | 762 | i = 0; |
763 | startFontSize = 1; | ||
764 | |||
716 | if ( version >= ADDRESSVERSION ) { | 765 | if ( version >= ADDRESSVERSION ) { |
@@ -728,2 +777,6 @@ void AddressbookWindow::initFields() | |||
728 | } | 777 | } |
778 | cfg.setGroup( "Font" ); | ||
779 | startFontSize = cfg.readNumEntry( "fontSize", 1 ); | ||
780 | |||
781 | |||
729 | } else { | 782 | } else { |