summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/mediummount/mainwindow.cc28
-rw-r--r--noncore/settings/mediummount/mainwindow.h7
-rw-r--r--noncore/settings/mediummount/mediumglobal.cc13
-rw-r--r--noncore/settings/mediummount/mediumglobal.h3
-rw-r--r--noncore/settings/mediummount/mediumwidget.cc2
-rw-r--r--noncore/settings/mediummount/mediumwidget.h3
6 files changed, 37 insertions, 19 deletions
diff --git a/noncore/settings/mediummount/mainwindow.cc b/noncore/settings/mediummount/mainwindow.cc
index 6d9bb80..bfd1e21 100644
--- a/noncore/settings/mediummount/mainwindow.cc
+++ b/noncore/settings/mediummount/mainwindow.cc
@@ -1,37 +1,42 @@
1 1
2 2
3#include <qtabwidget.h> 3#include <qtabwidget.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qtooltip.h>
6#include <qwhatsthis.h>
5 7
6#include <qpe/storage.h> 8#include <qpe/storage.h>
7 9
8#include "mediumwidget.h" 10#include "mediumwidget.h"
9#include "mediumglobal.h" 11#include "mediumglobal.h"
10 12
11#include "mainwindow.h" 13#include "mainwindow.h"
12 14
13using namespace MediumMountSetting; 15using namespace MediumMountSetting;
14 16
15 17
16MainWindow::MainWindow( QWidget *parent, const char *name, WFlags ) 18MainWindow::MainWindow( QWidget *parent, const char *name, bool modal, WFlags )
17 : QMainWindow( parent, name, WStyle_ContextHelp ) 19 : QDialog( parent, name, modal, WStyle_ContextHelp )
18 20
19{ 21{
20 setCaption ( tr( "Medium Mount Settings" )); 22 setCaption ( tr( "Medium Mount Settings" ));
21 23
22 // m_lay = new QVBoxLayout( this ); 24 m_lay = new QVBoxLayout( this );
25
23 m_tab = new QTabWidget( this ); 26 m_tab = new QTabWidget( this );
24 setCentralWidget( m_tab ); 27
28 m_lay->addWidget( m_tab );
29
25 init(); 30 init();
26} 31}
27 32
28MainWindow::~MainWindow() 33MainWindow::~MainWindow()
29{ 34{
30
31} 35}
36
32void MainWindow::init() 37void MainWindow::init()
33{ 38{
34 m_global = new MediumGlobalWidget( m_tab, "test drive" ); 39 m_global = new MediumGlobalWidget( m_tab, "test drive" );
35 m_tab->addTab( m_global, tr("Global") ); 40 m_tab->addTab( m_global, tr("Global") );
36 41
37 StorageInfo storage; 42 StorageInfo storage;
@@ -44,12 +49,25 @@ void MainWindow::init()
44 m_mediums.append( wid ); 49 m_mediums.append( wid );
45 m_tab->addTab( wid, (*it)->name() ); 50 m_tab->addTab( wid, (*it)->name() );
46 } 51 }
47 } 52 }
48} 53}
49 54
55void MainWindow::accept()
56{
57 m_global->writeConfig();
58
59 MediumMountWidget *confWidget;
60 for ( confWidget = m_mediums.first(); confWidget != 0;
61 confWidget = m_mediums.next() ) {
62 confWidget->writeConfig();
63 }
64
65 QDialog::accept();
66}
67
50void MainWindow::slotGlobalChanged(int ) 68void MainWindow::slotGlobalChanged(int )
51{ 69{
52 70
53} 71}
54void MainWindow::slotCheckingChanged(int ) 72void MainWindow::slotCheckingChanged(int )
55{ 73{
diff --git a/noncore/settings/mediummount/mainwindow.h b/noncore/settings/mediummount/mainwindow.h
index ce54674..9c648ef 100644
--- a/noncore/settings/mediummount/mainwindow.h
+++ b/noncore/settings/mediummount/mainwindow.h
@@ -1,29 +1,30 @@
1 1
2 2
3#ifndef MediumMountMainwindow_h 3#ifndef MediumMountMainwindow_h
4#define MediumMountMainwindow_h 4#define MediumMountMainwindow_h
5 5
6#include <qlist.h> 6#include <qlist.h>
7#include <qmainwindow.h> 7#include <qdialog.h>
8 8
9class QVBoxLayout; 9class QVBoxLayout;
10class QTabWidget; 10class QTabWidget;
11 11
12namespace MediumMountSetting { 12namespace MediumMountSetting {
13 class MediumMountWidget; 13 class MediumMountWidget;
14 class MediumGlobalWidget; 14 class MediumGlobalWidget;
15 class MainWindow : public QMainWindow { 15 class MainWindow : public QDialog {
16 Q_OBJECT 16 Q_OBJECT
17 public: 17 public:
18 MainWindow(QWidget *parent = 0, const char *name = 0 , WFlags = 0); 18 MainWindow(QWidget *parent = 0, const char *name = 0 , bool modal = FALSE, WFlags = 0);
19 ~MainWindow(); 19 ~MainWindow();
20 20
21 private slots: 21 private slots:
22 void slotGlobalChanged(int ); 22 void slotGlobalChanged(int );
23 void slotCheckingChanged(int ); 23 void slotCheckingChanged(int );
24 void accept();
24 private: 25 private:
25 void init(); 26 void init();
26 QTabWidget *m_tab; 27 QTabWidget *m_tab;
27 QVBoxLayout *m_lay; 28 QVBoxLayout *m_lay;
28 MediumGlobalWidget *m_global; 29 MediumGlobalWidget *m_global;
29 QList<MediumMountWidget> m_mediums; 30 QList<MediumMountWidget> m_mediums;
diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc
index fa4171c..46d3343 100644
--- a/noncore/settings/mediummount/mediumglobal.cc
+++ b/noncore/settings/mediummount/mediumglobal.cc
@@ -13,24 +13,24 @@
13 13
14#include "mediumglobal.h" 14#include "mediumglobal.h"
15 15
16using namespace MediumMountSetting; 16using namespace MediumMountSetting;
17 17
18MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) 18MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name )
19 : QWidget( wid, name ) 19 : QWidget( wid, name, WStyle_ContextHelp )
20{ 20{
21 m_config = 0; 21 m_config = 0;
22 initGUI(); 22 initGUI();
23 readConfig(); 23 readConfig();
24 24
25} 25}
26void MediumGlobalWidget::initGUI() 26void MediumGlobalWidget::initGUI()
27{ 27{
28 m_layout = new QVBoxLayout(this ); 28 m_layout = new QVBoxLayout(this );
29 m_layout->setMargin( 10 ); 29 // m_layout->setMargin( 10 );
30 m_layout->setSpacing( 10 ); 30 // m_layout->setSpacing( 10 );
31 31
32 32
33 m_label = new QLabel( this ); 33 m_label = new QLabel( this );
34 m_label->setTextFormat( Qt::RichText ); 34 m_label->setTextFormat( Qt::RichText );
35 m_label->setText( tr("") ); 35 m_label->setText( tr("") );
36 QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie " 36 QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie "
@@ -58,13 +58,13 @@ void MediumGlobalWidget::initGUI()
58 this, SLOT( slotGlobalChanged() ) ); 58 this, SLOT( slotGlobalChanged() ) );
59 59
60 m_box->addWidget( m_useglobal ); 60 m_box->addWidget( m_useglobal );
61 61
62 m_global = new QGroupBox( tr("Which media files"), m_frame ); 62 m_global = new QGroupBox( tr("Which media files"), m_frame );
63 m_frameLay = new QGridLayout(m_global, 4, 3 ); 63 m_frameLay = new QGridLayout(m_global, 4, 3 );
64 m_frameLay->setMargin( 12 ); 64 m_frameLay->setMargin( 6 );
65 65
66 QSpacerItem *item2 = new QSpacerItem( 5, 8, 66 QSpacerItem *item2 = new QSpacerItem( 5, 8,
67 QSizePolicy::Fixed, 67 QSizePolicy::Fixed,
68 QSizePolicy::Fixed ); 68 QSizePolicy::Fixed );
69 m_audio = new QCheckBox( tr("Audio"), m_global ); 69 m_audio = new QCheckBox( tr("Audio"), m_global );
70 m_all = new QCheckBox( tr("All") , m_global ); 70 m_all = new QCheckBox( tr("All") , m_global );
@@ -81,14 +81,14 @@ void MediumGlobalWidget::initGUI()
81 m_frameLay->addWidget( m_image, 2, 0 ); 81 m_frameLay->addWidget( m_image, 2, 0 );
82 m_frameLay->addWidget( m_all, 3, 0 ); 82 m_frameLay->addWidget( m_all, 3, 0 );
83 83
84 m_frameLay->addWidget( m_text, 1, 2 ); 84 m_frameLay->addWidget( m_text, 1, 2 );
85 m_frameLay->addWidget( m_video, 2, 2 ); 85 m_frameLay->addWidget( m_video, 2, 2 );
86 86
87 m_frameLay->addRowSpacing( 0, 8 ); 87// m_frameLay->addRowSpacing( 0, 8 );
88 m_frameLay->addColSpacing( 1, 2 ); 88// m_frameLay->addColSpacing( 1, 2 );
89 89
90 m_box->addWidget( m_global ); 90 m_box->addWidget( m_global );
91 91
92 92
93 m_layout->addWidget( m_frame ); 93 m_layout->addWidget( m_frame );
94 94
@@ -137,13 +137,12 @@ void MediumGlobalWidget::writeConfig()
137 m_config->writeEntry("video", m_video->isChecked() ); 137 m_config->writeEntry("video", m_video->isChecked() );
138 m_config->writeEntry("text", m_text->isChecked() ); 138 m_config->writeEntry("text", m_text->isChecked() );
139 m_config->writeEntry("image", m_image->isChecked() ); 139 m_config->writeEntry("image", m_image->isChecked() );
140} 140}
141MediumGlobalWidget::~MediumGlobalWidget() 141MediumGlobalWidget::~MediumGlobalWidget()
142{ 142{
143 writeConfig();
144 delete m_config; 143 delete m_config;
145} 144}
146void MediumGlobalWidget::slotGlobalChanged() 145void MediumGlobalWidget::slotGlobalChanged()
147{ 146{
148 int mode = GLOBAL_DISABLED; 147 int mode = GLOBAL_DISABLED;
149 bool enabled = false; 148 bool enabled = false;
diff --git a/noncore/settings/mediummount/mediumglobal.h b/noncore/settings/mediummount/mediumglobal.h
index 7b3cea0..ea1f0df 100644
--- a/noncore/settings/mediummount/mediumglobal.h
+++ b/noncore/settings/mediummount/mediumglobal.h
@@ -20,25 +20,26 @@ namespace MediumMountSetting {
20 20
21 class MediumGlobalWidget : public QWidget { 21 class MediumGlobalWidget : public QWidget {
22 Q_OBJECT 22 Q_OBJECT
23 public: 23 public:
24 MediumGlobalWidget(QWidget *parent = 0, const char *name =0 ); 24 MediumGlobalWidget(QWidget *parent = 0, const char *name =0 );
25 ~MediumGlobalWidget(); 25 ~MediumGlobalWidget();
26
27 void writeConfig();
26 signals: 28 signals:
27 // the global status changed 29 // the global status changed
28 void globalStateChanged( int ); 30 void globalStateChanged( int );
29 void enableStateChanged( int ); 31 void enableStateChanged( int );
30 private slots: 32 private slots:
31 void slotGlobalChanged(); 33 void slotGlobalChanged();
32 void slotEnableChecking(); 34 void slotEnableChecking();
33 void slotAllChanged(); 35 void slotAllChanged();
34 36
35 private: 37 private:
36 void initGUI(); 38 void initGUI();
37 void readConfig(); 39 void readConfig();
38 void writeConfig();
39 Config *m_config; 40 Config *m_config;
40 QCheckBox *m_check; 41 QCheckBox *m_check;
41 QCheckBox *m_useglobal; 42 QCheckBox *m_useglobal;
42 43
43 QGroupBox *m_global; 44 QGroupBox *m_global;
44 45
diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc
index 04e4e7c..f98e637 100644
--- a/noncore/settings/mediummount/mediumwidget.cc
+++ b/noncore/settings/mediummount/mediumwidget.cc
@@ -168,17 +168,15 @@ void MediumMountWidget::writeConfig()
168 m_config->writeEntry("text" , m_text->isChecked() ); 168 m_config->writeEntry("text" , m_text->isChecked() );
169 m_config->writeEntry("video", m_video->isChecked() ); 169 m_config->writeEntry("video", m_video->isChecked() );
170 } 170 }
171} 171}
172MediumMountWidget::~MediumMountWidget() 172MediumMountWidget::~MediumMountWidget()
173{ 173{
174 writeConfig();
175 delete m_config; 174 delete m_config;
176} 175}
177 176
178
179void MediumMountWidget::slotAdd() 177void MediumMountWidget::slotAdd()
180{ 178{
181 179
182} 180}
183void MediumMountWidget::slotStateChanged() 181void MediumMountWidget::slotStateChanged()
184{ 182{
diff --git a/noncore/settings/mediummount/mediumwidget.h b/noncore/settings/mediummount/mediumwidget.h
index 7a801eb..7f7b755 100644
--- a/noncore/settings/mediummount/mediumwidget.h
+++ b/noncore/settings/mediummount/mediumwidget.h
@@ -24,20 +24,21 @@ namespace MediumMountSetting {
24 class MediumMountWidget : public QWidget { 24 class MediumMountWidget : public QWidget {
25 Q_OBJECT 25 Q_OBJECT
26 public: 26 public:
27 MediumMountWidget(const QString&, const QPixmap &, QWidget *parent, const char *name = 0 ); 27 MediumMountWidget(const QString&, const QPixmap &, QWidget *parent, const char *name = 0 );
28 ~MediumMountWidget(); 28 ~MediumMountWidget();
29 29
30 void writeConfig();
31
30 private slots: 32 private slots:
31 void slotAdd(); 33 void slotAdd();
32 void slotStateChanged(); 34 void slotStateChanged();
33 35
34 private: 36 private:
35 void readConfig(); 37 void readConfig();
36 void initGUI(); 38 void initGUI();
37 void writeConfig();
38 39
39 bool m_dirty : 1; 40 bool m_dirty : 1;
40 41
41 class MediumMountWidgetPrivate; 42 class MediumMountWidgetPrivate;
42 MediumMountWidgetPrivate *d; 43 MediumMountWidgetPrivate *d;
43 44