Diffstat (limited to 'noncore/settings/mediummount') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/mediummount/mainwindow.cc | 34 | ||||
-rw-r--r-- | noncore/settings/mediummount/mainwindow.h | 7 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumglobal.cc | 19 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumglobal.h | 3 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.cc | 10 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.h | 5 |
6 files changed, 48 insertions, 30 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 @@ -2,6 +2,8 @@ #include <qtabwidget.h> #include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> #include <qpe/storage.h> @@ -13,22 +15,25 @@ using namespace MediumMountSetting; -MainWindow::MainWindow( QWidget *parent, const char *name, WFlags ) - : QMainWindow( parent, name, WStyle_ContextHelp ) +MainWindow::MainWindow( QWidget *parent, const char *name, bool modal, WFlags ) + : QDialog( parent, name, modal, WStyle_ContextHelp ) { - setCaption ( tr( "Medium Mount Settings" )); + setCaption ( tr( "Medium Mount Settings" )); - // m_lay = new QVBoxLayout( this ); - m_tab = new QTabWidget( this ); - setCentralWidget( m_tab ); - init(); + m_lay = new QVBoxLayout( this ); + + m_tab = new QTabWidget( this ); + + m_lay->addWidget( m_tab ); + + init(); } MainWindow::~MainWindow() { - } + void MainWindow::init() { m_global = new MediumGlobalWidget( m_tab, "test drive" ); @@ -47,6 +52,19 @@ void MainWindow::init() } } +void MainWindow::accept() +{ + m_global->writeConfig(); + + MediumMountWidget *confWidget; + for ( confWidget = m_mediums.first(); confWidget != 0; + confWidget = m_mediums.next() ) { + confWidget->writeConfig(); + } + + QDialog::accept(); +} + void MainWindow::slotGlobalChanged(int ) { 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 @@ -4,7 +4,7 @@ #define MediumMountMainwindow_h #include <qlist.h> -#include <qmainwindow.h> +#include <qdialog.h> class QVBoxLayout; class QTabWidget; @@ -12,15 +12,16 @@ class QTabWidget; namespace MediumMountSetting { class MediumMountWidget; class MediumGlobalWidget; - class MainWindow : public QMainWindow { + class MainWindow : public QDialog { Q_OBJECT public: - MainWindow(QWidget *parent = 0, const char *name = 0 , WFlags = 0); + MainWindow(QWidget *parent = 0, const char *name = 0 , bool modal = FALSE, WFlags = 0); ~MainWindow(); private slots: void slotGlobalChanged(int ); void slotCheckingChanged(int ); + void accept(); private: void init(); QTabWidget *m_tab; 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 @@ -16,7 +16,7 @@ using namespace MediumMountSetting; MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) - : QWidget( wid, name ) + : QWidget( wid, name, WStyle_ContextHelp ) { m_config = 0; initGUI(); @@ -26,8 +26,8 @@ MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) void MediumGlobalWidget::initGUI() { m_layout = new QVBoxLayout(this ); - m_layout->setMargin( 10 ); - m_layout->setSpacing( 10 ); + // m_layout->setMargin( 10 ); + // m_layout->setSpacing( 10 ); m_label = new QLabel( this ); @@ -39,7 +39,7 @@ void MediumGlobalWidget::initGUI() "if Opie should scan for Documents globally or on a " "per medium level. You're also able to reconfigure " "each medium.") ); - + m_layout->addWidget( m_label ); m_check = new QCheckBox( tr("Enable medium checking" ), this ); @@ -61,11 +61,11 @@ void MediumGlobalWidget::initGUI() m_global = new QGroupBox( tr("Which media files"), m_frame ); m_frameLay = new QGridLayout(m_global, 4, 3 ); - m_frameLay->setMargin( 12 ); + m_frameLay->setMargin( 6 ); QSpacerItem *item2 = new QSpacerItem( 5, 8, QSizePolicy::Fixed, - QSizePolicy::Fixed ); + QSizePolicy::Fixed ); m_audio = new QCheckBox( tr("Audio"), m_global ); m_all = new QCheckBox( tr("All") , m_global ); m_image = new QCheckBox( tr("Image"), m_global ); @@ -84,11 +84,11 @@ void MediumGlobalWidget::initGUI() m_frameLay->addWidget( m_text, 1, 2 ); m_frameLay->addWidget( m_video, 2, 2 ); - m_frameLay->addRowSpacing( 0, 8 ); - m_frameLay->addColSpacing( 1, 2 ); +// m_frameLay->addRowSpacing( 0, 8 ); +// m_frameLay->addColSpacing( 1, 2 ); m_box->addWidget( m_global ); - + m_layout->addWidget( m_frame ); @@ -140,7 +140,6 @@ void MediumGlobalWidget::writeConfig() } MediumGlobalWidget::~MediumGlobalWidget() { - writeConfig(); delete m_config; } void MediumGlobalWidget::slotGlobalChanged() 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 @@ -23,6 +23,8 @@ namespace MediumMountSetting { public: MediumGlobalWidget(QWidget *parent = 0, const char *name =0 ); ~MediumGlobalWidget(); + + void writeConfig(); signals: // the global status changed void globalStateChanged( int ); @@ -35,7 +37,6 @@ namespace MediumMountSetting { private: void initGUI(); void readConfig(); - void writeConfig(); Config *m_config; QCheckBox *m_check; QCheckBox *m_useglobal; 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 @@ -36,7 +36,7 @@ MediumMountWidget::MediumMountWidget(const QString &path, m_path = path; initGUI(); m_label->setPixmap(pix ); - m_config = 0; + m_config = 0; readConfig(); } @@ -81,7 +81,7 @@ void MediumMountWidget::initGUI() m_text = new QCheckBox( tr("Text") , m_group ); m_video = new QCheckBox( tr("Video"), m_group ); - QSpacerItem *iti1b = new QSpacerItem(2, 10, QSizePolicy::Fixed, + QSpacerItem *iti1b = new QSpacerItem(2, 10, QSizePolicy::Fixed, QSizePolicy::Fixed ); m_checks->addItem( iti1b, 0, 0 ); @@ -96,7 +96,7 @@ void MediumMountWidget::initGUI() m_checks->addColSpacing(1, 2 ); m_checks->setColStretch(1, -2 ); - connect(m_all, SIGNAL(stateChanged(int) ), + connect(m_all, SIGNAL(stateChanged(int) ), this, SLOT(slotStateChanged() ) ); m_box->addWidget( m_group ); @@ -143,7 +143,7 @@ void MediumMountWidget::readConfig( ) m_audio->setEnabled( true ); m_image->setEnabled( true ); m_text->setEnabled ( true ); - m_all->setEnabled ( true ); + m_all->setEnabled ( true ); m_all->setChecked( false ); @@ -171,11 +171,9 @@ void MediumMountWidget::writeConfig() } MediumMountWidget::~MediumMountWidget() { - writeConfig(); delete m_config; } - void MediumMountWidget::slotAdd() { 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 @@ -26,6 +26,8 @@ namespace MediumMountSetting { public: MediumMountWidget(const QString&, const QPixmap &, QWidget *parent, const char *name = 0 ); ~MediumMountWidget(); + + void writeConfig(); private slots: void slotAdd(); @@ -34,8 +36,7 @@ namespace MediumMountSetting { private: void readConfig(); void initGUI(); - void writeConfig(); - + bool m_dirty : 1; class MediumMountWidgetPrivate; |