summaryrefslogtreecommitdiff
path: root/libopie/ofontmenu.cc
Unidiff
Diffstat (limited to 'libopie/ofontmenu.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofontmenu.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc
index 2acae1c..52ff3ee 100644
--- a/libopie/ofontmenu.cc
+++ b/libopie/ofontmenu.cc
@@ -1,4 +1,6 @@
1 1
2
3#include <qpe/config.h>
2#include "ofontmenu.h" 4#include "ofontmenu.h"
3 5
4 6
@@ -7,6 +9,8 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li
7 : QPopupMenu( parent, name ) 9 : QPopupMenu( parent, name )
8{ 10{
9 m_list = list; 11 m_list = list;
12 m_wids.setAutoDelete( TRUE );
13
10 insertItem(tr("Large"), this, SLOT(slotLarge() ), 14 insertItem(tr("Large"), this, SLOT(slotLarge() ),
11 0, 10); 15 0, 10);
12 insertItem(tr("Medium"), this, SLOT(slotMedium() ), 16 insertItem(tr("Medium"), this, SLOT(slotMedium() ),
@@ -14,6 +18,34 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li
14 insertItem(tr("Small"), this, SLOT(slotSmall() ), 18 insertItem(tr("Small"), this, SLOT(slotSmall() ),
15 0, 12 ); 19 0, 12 );
16 setCheckable( true ); 20 setCheckable( true );
21 m_size=10;
22}
23void OFontMenu::save(Config *cfg )
24{
25 cfg->setGroup("OFontMenu" );
26 cfg->writeEntry("size", m_size );
27}
28void OFontMenu::restore(Config *cfg )
29{
30 cfg->setGroup("OFontMeny" );
31 m_size = cfg->readNumEntry("size" );
32 setItemChecked(10, false );
33 setItemChecked(11, false );
34 setItemChecked(12, false );
35 switch( m_size ){
36 case 8:
37 setItemChecked(12, true );
38 break;
39 case 14:
40 setItemChecked(10, true );
41 break;
42 case 10:// fall through
43 default:
44 setItemChecked(11, true );
45 m_size = 10;
46 break;
47 }
48 setFontSize( m_size );
17} 49}
18void OFontMenu::setWidgets(const QList<QWidget> &list ) 50void OFontMenu::setWidgets(const QList<QWidget> &list )
19{ 51{
@@ -61,6 +93,7 @@ void OFontMenu::slotLarge()
61} 93}
62void OFontMenu::setFontSize(int size ) 94void OFontMenu::setFontSize(int size )
63{ 95{
96 m_size = size;
64 QWidget *wid; 97 QWidget *wid;
65 for(wid = m_list.first(); wid !=0; wid = m_list.next() ){ 98 for(wid = m_list.first(); wid !=0; wid = m_list.next() ){
66 QFont font = wid->font(); 99 QFont font = wid->font();
@@ -75,4 +108,5 @@ void OFontMenu::setFontSize(int size )
75 wids->wid->setFont( font ); 108 wids->wid->setFont( font );
76 } 109 }
77 } 110 }
111 emit fontChanged(size );
78} 112}