-rw-r--r-- | core/launcher/mediummountgui.cpp | 24 | ||||
-rw-r--r-- | core/launcher/mediummountgui.h | 8 |
2 files changed, 9 insertions, 23 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp index 6d60ce4..b0a1b10 100644 --- a/core/launcher/mediummountgui.cpp +++ b/core/launcher/mediummountgui.cpp @@ -123,95 +123,85 @@ void MediumMountGui::startGui() { CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); CheckBoxText->setText( tr( "Text" ) ); CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); CheckBoxVideo->setText( tr( "Video" ) ); CheckBoxAll = new QCheckBox ( GroupBox1 ); CheckBoxAll->setText( tr( "All" ) ); CheckBoxLink = new QCheckBox ( GroupBox1 ); CheckBoxLink->setText( tr( "Link apps" ) ); // as long as the feature is not supported CheckBoxLink->setEnabled( false ); mimeLayout->addWidget( CheckBoxAudio, 0, 0 ); mimeLayout->addWidget( CheckBoxImage, 0, 1 ); mimeLayout->addWidget( CheckBoxText , 1, 0 ); mimeLayout->addWidget( CheckBoxVideo, 1, 1 ); mimeLayout->addWidget( CheckBoxAll, 2, 0 ); mimeLayout->addWidget( CheckBoxLink, 2, 1 ); connect( CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers() ) ); QVBox* dirBox = new QVBox( this ); - dirBox->setMargin( 4 ); + dirBox->setMargin( 5 ); // select dirs DirSelectText = new QLabel( dirBox, "DirSelectText" ); DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); QHBox* dirLineBox = new QHBox( dirBox ); LineEdit1 = new QLineEdit( dirLineBox ); PushButton3 = new QPushButton( dirLineBox ); PushButton3->setText( tr( "Add" ) ); + PushButton3->setFocus(); // decision DirSelectText_2 = new QLabel( dirBox ); DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); // ask again AskBox = new QCheckBox( dirBox ); AskBox->setText( tr( "Do not ask again for this medium" ) ); AskBox->setChecked( checkagain ); CheckBoxAudio->setChecked( checkmimeaudio ); CheckBoxImage->setChecked( checkmimeimage ); CheckBoxText->setChecked( checkmimetext ); CheckBoxVideo->setChecked( checkmimevideo ); CheckBoxAll->setChecked( checkmimeall ); deactivateOthers(); - QHBox* buttonBox = new QHBox( this ); - // buttons - quit = new QPushButton( buttonBox ); - quit->setFocus(); - quit->setText( tr( "Yes" ) ); - quit_2 = new QPushButton( buttonBox ); - quit_2->setText( tr( "No" ) ); - mainLayout->addWidget( GroupBox1 ); mainLayout->addWidget( dirBox ); - mainLayout->addWidget( buttonBox ); - - connect( quit, SIGNAL( clicked() ), this, SLOT( yesPressed() ) ); - connect( quit_2, SIGNAL( clicked() ), this, SLOT( noPressed() ) ); + mainLayout->addStretch( 0 ); } void MediumMountGui::deactivateOthers() { bool mod = !( CheckBoxAll->isChecked() ); CheckBoxVideo->setEnabled( mod ); CheckBoxAudio->setEnabled( mod ); CheckBoxText->setEnabled( mod ); CheckBoxImage->setEnabled( mod ); } -void MediumMountGui::yesPressed() { +void MediumMountGui::accept() { writeConfig( true ); // and do something - accept(); + QDialog::accept(); } QStringList MediumMountGui::mimeTypes() { return mimeTypeList; } -void MediumMountGui::noPressed() { +void MediumMountGui::reject() { writeConfig( false ); - reject(); + QDialog::reject(); } MediumMountGui::~MediumMountGui() { } diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h index 39f9a52..d5c0fe7 100644 --- a/core/launcher/mediummountgui.h +++ b/core/launcher/mediummountgui.h @@ -1,71 +1,67 @@ #ifndef MEDIUMMOUNTGUI_H #define MEDIUMMOUNTGUI_H #include <qvariant.h> #include <qdialog.h> class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QCheckBox; class QGroupBox; class QLabel; class QLineEdit; class QPushButton; class Config; class MediumMountGui : public QDialog { Q_OBJECT public: MediumMountGui( Config *cfg, const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); ~MediumMountGui(); protected: - QPushButton* quit; - QPushButton* quit_2; QLabel* DirSelectText_2; QLineEdit* LineEdit1; QPushButton* PushButton3; QLabel* DirSelectText; QLabel* Text_2; QLabel* Text; QGroupBox* GroupBox1; QCheckBox* CheckBoxAudio; QCheckBox* CheckBoxImage; QCheckBox* CheckBoxText; QCheckBox* CheckBoxVideo; QCheckBox* CheckBoxAll; QCheckBox* CheckBoxLink; QCheckBox* AskBox; - public: bool check(); QStringList mimeTypes(); QStringList dirs(); private: void startGui(); void readConfig(); void writeConfig( bool checkagain ); private slots: - void yesPressed(); - void noPressed(); + void accept(); + void reject(); void deactivateOthers(); private: QString mediumPath; - bool checkagain:1; bool checkmimeaudio:1; bool checkmimeimage:1; bool checkmimetext:1; bool checkmimevideo:1; bool checkmimeall:1; QString limittodirs; QStringList mimeTypeList; Config *m_cfg; }; #endif |