summaryrefslogtreecommitdiff
authortux_mike <tux_mike>2002-04-09 03:22:49 (UTC)
committer tux_mike <tux_mike>2002-04-09 03:22:49 (UTC)
commit0099a303b216b57e22aea5e28ee31abb6fb18736 (patch) (side-by-side diff)
tree308c64b1d48553bf067ae36303728248322311fe
parent3c37907fd38287a8402cca1063ce6ba69c75e954 (diff)
downloadopie-0099a303b216b57e22aea5e28ee31abb6fb18736.zip
opie-0099a303b216b57e22aea5e28ee31abb6fb18736.tar.gz
opie-0099a303b216b57e22aea5e28ee31abb6fb18736.tar.bz2
Added font selection.
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
@@ -212,10 +212,54 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
mbList->insertItem( tr("View"), catMenu );
setCentralWidget( abList );
+ 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;
+ }
+}
+
void AddressbookWindow::setDocument( const QString &filename )
{
if ( filename.find(".vcf") != int(filename.length()) - 4 ) return;
@@ -243,8 +287,11 @@ void AddressbookWindow::resizeEvent( QResizeEvent *e )
}
AddressbookWindow::~AddressbookWindow()
{
+ Config cfg("AddressBook");
+ cfg.setGroup("Font");
+ cfg.writeEntry("fontSize", startFontSize);
}
void AddressbookWindow::slotUpdateToolbar()
{
@@ -712,8 +759,10 @@ void AddressbookWindow::initFields()
cfg.setGroup( "Version" );
version = cfg.readNumEntry( "version" );
i = 0;
+ startFontSize = 1;
+
if ( version >= ADDRESSVERSION ) {
cfg.setGroup( "ImportantCategory" );
@@ -725,8 +774,12 @@ void AddressbookWindow::initFields()
}
slOrderedFields.append( zn );
zn = cfg.readEntry( "Category" + QString::number(++i), QString::null );
}
+ cfg.setGroup( "Font" );
+ startFontSize = cfg.readNumEntry( "fontSize", 1 );
+
+
} else {
QString str;
str = getenv("HOME");
str += "/Settings/AddressBook.conf";
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
@@ -69,15 +69,15 @@ private slots:
void beamDone( Ir * );
void slotFind();
void slotSetCategory( int );
void slotUpdateToolbar();
-
+ void slotSetFont(int);
private:
void initFields(); // inititialize our fields...
AbLabel *abView();
void populateCategories();
- QPopupMenu *catMenu;
+ QPopupMenu *catMenu, *fontMenu;
QPEToolBar *listTools;
QToolButton *deleteButton;
QValueList<int> allFields,
orderedFields;
@@ -93,7 +93,9 @@ private:
bool bAbEditFirstTime;
int viewMargin;
bool syncing;
+ QFont *defaultFont;
+ int startFontSize;
};
#endif