summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp53
-rw-r--r--core/pim/addressbook/addressbook.h6
2 files changed, 57 insertions, 2 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,
+ fontMenu = new QPopupMenu(this);
+ fontMenu->setCheckable( true );
+ connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
+
+ fontMenu->insertItem("Small", 0);
+ fontMenu->insertItem("Normal", 1);
+ fontMenu->insertItem("Large", 2);
+
+ defaultFont = new QFont( abList->font() );
+
+ slotSetFont(startFontSize);
+
+ mbList->insertItem( tr("Font"), fontMenu);
+ setCentralWidget(abList);
+
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
}
+void AddressbookWindow::slotSetFont( int size ) {
+
+ if (size > 2 || size < 0)
+ size = 1;
+
+ startFontSize = size;
+
+ switch (size) {
+ case 0:
+ fontMenu->setItemChecked(0, true);
+ fontMenu->setItemChecked(1, false);
+ fontMenu->setItemChecked(2, false);
+ abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
+ break;
+ case 1:
+ fontMenu->setItemChecked(0, false);
+ fontMenu->setItemChecked(1, true);
+ fontMenu->setItemChecked(2, false);
+ abList->setFont( *defaultFont );
+ break;
+ case 2:
+ fontMenu->setItemChecked(0, false);
+ fontMenu->setItemChecked(1, false);
+ fontMenu->setItemChecked(2, true);
+ abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
+ break;
+ }
+}
+
@@ -246,2 +290,5 @@ AddressbookWindow::~AddressbookWindow()
{
+ Config cfg("AddressBook");
+ cfg.setGroup("Font");
+ cfg.writeEntry("fontSize", startFontSize);
}
@@ -715,2 +762,4 @@ void AddressbookWindow::initFields()
i = 0;
+ startFontSize = 1;
+
if ( version >= ADDRESSVERSION ) {
@@ -728,2 +777,6 @@ void AddressbookWindow::initFields()
}
+ cfg.setGroup( "Font" );
+ startFontSize = cfg.readNumEntry( "fontSize", 1 );
+
+
} else {
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index 342077f..e2a7100 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -72,3 +72,3 @@ private slots:
void slotUpdateToolbar();
-
+ void slotSetFont(int);
private:
@@ -78,3 +78,3 @@ private:
- QPopupMenu *catMenu;
+ QPopupMenu *catMenu, *fontMenu;
QPEToolBar *listTools;
@@ -96,2 +96,4 @@ private:
bool syncing;
+ QFont *defaultFont;
+ int startFontSize;
};