summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/mediummountgui.cpp5
-rw-r--r--core/launcher/mediummountgui.h6
2 files changed, 6 insertions, 5 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
index 0be90e6..2454efa 100644
--- a/core/launcher/mediummountgui.cpp
+++ b/core/launcher/mediummountgui.cpp
@@ -1,165 +1,166 @@
1 1
2#include "mediummountgui.h" 2#include "mediummountgui.h"
3 3
4#include <qvariant.h> 4#include <qvariant.h>
5#include <qcheckbox.h> 5#include <qcheckbox.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qlayout.h> 10#include <qlayout.h>
11#include <qtooltip.h> 11#include <qtooltip.h>
12#include <qwhatsthis.h> 12#include <qwhatsthis.h>
13#include <qimage.h> 13#include <qimage.h>
14#include <qpixmap.h> 14#include <qpixmap.h>
15 15
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <opie/oconfig.h> 17#include <opie/oconfig.h>
18 18
19 19
20#include <qapplication.h> 20#include <qapplication.h>
21 21
22 22
23MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, WFlags fl ) 23MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl )
24 : QWidget( parent, name, fl ) { 24 : QDialog( parent, name, modal, fl ) {
25
25 26
26 QWidget *d = QApplication::desktop(); 27 QWidget *d = QApplication::desktop();
27 int w=d->width(); 28 int w=d->width();
28 int h=d->height(); 29 int h=d->height();
29 resize( w , h ); 30 resize( w , h );
30 setCaption( tr( "Medium inserted" ) ); 31 setCaption( tr( "Medium inserted" ) );
31 32
32 mediumPath = path; 33 mediumPath = path;
33 readConfig(); 34 readConfig();
34 startGui(); 35 startGui();
35} 36}
36 37
37void MediumMountGui::readConfig(){ 38void MediumMountGui::readConfig(){
38 39
39 OConfig cfg (mediumPath +"/.opiestorage.cf"); 40 OConfig cfg (mediumPath +"/.opiestorage.cf");
40 cfg.setGroup("main"); 41 cfg.setGroup("main");
41 checkagain = cfg.readBoolEntry("check", false); 42 checkagain = cfg.readBoolEntry("check", false);
42 43
43 cfg.setGroup("mimetypes"); 44 cfg.setGroup("mimetypes");
44 checkmimeaudio = cfg.readBoolEntry("audio", false); 45 checkmimeaudio = cfg.readBoolEntry("audio", false);
45 checkmimeimage = cfg.readBoolEntry("image", true); 46 checkmimeimage = cfg.readBoolEntry("image", true);
46 checkmimetext = cfg.readBoolEntry("text", true); 47 checkmimetext = cfg.readBoolEntry("text", true);
47 checkmimevideo = cfg.readBoolEntry("video", true); 48 checkmimevideo = cfg.readBoolEntry("video", true);
48 49
49 cfg.setGroup("dirs"); 50 cfg.setGroup("dirs");
50 limittodirs = cfg.readEntry("dirs", "/"); 51 limittodirs = cfg.readEntry("dirs", "/");
51} 52}
52 53
53bool MediumMountGui::check() { 54bool MediumMountGui::check() {
54 return checkagain; 55 return checkagain;
55} 56}
56 57
57 58
58void MediumMountGui::writeConfig() { 59void MediumMountGui::writeConfig() {
59 60
60 OConfig cfg (mediumPath +"/.opiestorage.cf"); 61 OConfig cfg (mediumPath +"/.opiestorage.cf");
61 cfg.setGroup("main"); 62 cfg.setGroup("main");
62 cfg.writeEntry("check", AskBox->isChecked() ); 63 cfg.writeEntry("check", AskBox->isChecked() );
63 64
64 cfg.setGroup("mimetypes"); 65 cfg.setGroup("mimetypes");
65 cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); 66 cfg.writeEntry("audio", CheckBoxAudio->isChecked() );
66 cfg.writeEntry("image",CheckBoxImage->isChecked() ); 67 cfg.writeEntry("image",CheckBoxImage->isChecked() );
67 cfg.writeEntry("text",CheckBoxImage->isChecked() ); 68 cfg.writeEntry("text",CheckBoxImage->isChecked() );
68 cfg.writeEntry("video",CheckBoxVideo->isChecked() ); 69 cfg.writeEntry("video",CheckBoxVideo->isChecked() );
69 70
70 cfg.setGroup("dirs"); 71 cfg.setGroup("dirs");
71 cfg.writeEntry("dirs", "/"); 72 cfg.writeEntry("dirs", "/");
72} 73}
73 74
74void MediumMountGui::startGui() { 75void MediumMountGui::startGui() {
75 76
76 QPixmap image = Resource::loadPixmap( "HelpBrowser"); 77 QPixmap image = Resource::loadPixmap( "HelpBrowser");
77 78
78 Text_2 = new QLabel( this ); 79 Text_2 = new QLabel( this );
79 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); 80 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) );
80 Text_2->setPixmap( image ); 81 Text_2->setPixmap( image );
81 82
82 Text = new QLabel( this, "Text" ); 83 Text = new QLabel( this, "Text" );
83 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); 84 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) );
84 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); 85 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
85 86
86 // media box 87 // media box
87 GroupBox1 = new QGroupBox( this, "GroupBox1" ); 88 GroupBox1 = new QGroupBox( this, "GroupBox1" );
88 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 60 ) ); 89 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 60 ) );
89 GroupBox1->setTitle( tr( "Which media files" ) ); 90 GroupBox1->setTitle( tr( "Which media files" ) );
90 91
91 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); 92 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
92 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); 93 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) );
93 CheckBoxAudio->setText( tr( "Audio" ) ); 94 CheckBoxAudio->setText( tr( "Audio" ) );
94 95
95 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); 96 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
96 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); 97 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) );
97 CheckBoxImage->setText( tr( "Image" ) ); 98 CheckBoxImage->setText( tr( "Image" ) );
98 99
99 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); 100 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
100 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); 101 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) );
101 CheckBoxText->setText( tr( "Text" ) ); 102 CheckBoxText->setText( tr( "Text" ) );
102 103
103 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); 104 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
104 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); 105 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) );
105 CheckBoxVideo->setText( tr( "Video" ) ); 106 CheckBoxVideo->setText( tr( "Video" ) );
106 107
107 // select dirs 108 // select dirs
108 109
109 DirSelectText = new QLabel( this, "DirSelectText" ); 110 DirSelectText = new QLabel( this, "DirSelectText" );
110 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) ); 111 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) );
111 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); 112 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) );
112 113
113 LineEdit1 = new QLineEdit( this ); 114 LineEdit1 = new QLineEdit( this );
114 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) ); 115 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) );
115 116
116 PushButton3 = new QPushButton( this ); 117 PushButton3 = new QPushButton( this );
117 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) ); 118 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) );
118 PushButton3->setText( tr( "Add" ) ); 119 PushButton3->setText( tr( "Add" ) );
119 120
120 121
121 // decision 122 // decision
122 DirSelectText_2 = new QLabel( this ); 123 DirSelectText_2 = new QLabel( this );
123 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) ); 124 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) );
124 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); 125 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) );
125 126
126 // ask again 127 // ask again
127 AskBox = new QCheckBox( this ); 128 AskBox = new QCheckBox( this );
128 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); 129 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) );
129 AskBox->setText( tr( "Do not ask again for this medium" ) ); 130 AskBox->setText( tr( "Do not ask again for this medium" ) );
130 131
131 132
132 AskBox->setChecked(checkagain); 133 AskBox->setChecked(checkagain);
133 CheckBoxAudio->setChecked(checkmimeaudio); 134 CheckBoxAudio->setChecked(checkmimeaudio);
134 CheckBoxImage->setChecked(checkmimeimage); 135 CheckBoxImage->setChecked(checkmimeimage);
135 CheckBoxText->setChecked(checkmimetext); 136 CheckBoxText->setChecked(checkmimetext);
136 CheckBoxVideo->setChecked(checkmimevideo); 137 CheckBoxVideo->setChecked(checkmimevideo);
137 138
138 // buttons 139 // buttons
139 quit = new QPushButton( this ); 140 quit = new QPushButton( this );
140 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); 141 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) );
141 quit->setFocus(); 142 quit->setFocus();
142 quit->setText( tr( "Yes" ) ); 143 quit->setText( tr( "Yes" ) );
143 144
144 quit_2 = new QPushButton( this ); 145 quit_2 = new QPushButton( this );
145 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); 146 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) );
146 quit_2->setText( tr( "No" ) ); 147 quit_2->setText( tr( "No" ) );
147 148
148 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); 149 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) );
149 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); 150 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) );
150 151
151 152
152} 153}
153 154
154void MediumMountGui::yesPressed() { 155void MediumMountGui::yesPressed() {
155 writeConfig(); 156 writeConfig();
156 // and do something 157 // and do something
157} 158}
158 159
159void MediumMountGui::noPressed() { 160void MediumMountGui::noPressed() {
160 close(); 161 close();
161} 162}
162 163
163MediumMountGui::~MediumMountGui(){ 164MediumMountGui::~MediumMountGui(){
164} 165}
165 166
diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h
index 0da2803..700a922 100644
--- a/core/launcher/mediummountgui.h
+++ b/core/launcher/mediummountgui.h
@@ -1,63 +1,63 @@
1#ifndef MEDIUMMOUNTGUI_H 1#ifndef MEDIUMMOUNTGUI_H
2#define MEDIUMMOUNTGUI_H 2#define MEDIUMMOUNTGUI_H
3 3
4#include <qvariant.h> 4#include <qvariant.h>
5#include <qwidget.h> 5#include <qdialog.h>
6class QVBoxLayout; 6class QVBoxLayout;
7class QHBoxLayout; 7class QHBoxLayout;
8class QGridLayout; 8class QGridLayout;
9class QCheckBox; 9class QCheckBox;
10class QGroupBox; 10class QGroupBox;
11class QLabel; 11class QLabel;
12class QLineEdit; 12class QLineEdit;
13class QPushButton; 13class QPushButton;
14 14
15class MediumMountGui : public QWidget 15class MediumMountGui : public QDialog
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 MediumMountGui( const QString &path = "/tmp/", QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 20 MediumMountGui( const QString &path = "/tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 );
21 ~MediumMountGui(); 21 ~MediumMountGui();
22 22
23protected: 23protected:
24 QPushButton* quit; 24 QPushButton* quit;
25 QPushButton* quit_2; 25 QPushButton* quit_2;
26 QLabel* DirSelectText_2; 26 QLabel* DirSelectText_2;
27 QLineEdit* LineEdit1; 27 QLineEdit* LineEdit1;
28 QPushButton* PushButton3; 28 QPushButton* PushButton3;
29 QLabel* DirSelectText; 29 QLabel* DirSelectText;
30 QLabel* Text_2; 30 QLabel* Text_2;
31 QLabel* Text; 31 QLabel* Text;
32 QGroupBox* GroupBox1; 32 QGroupBox* GroupBox1;
33 QCheckBox* CheckBoxAudio; 33 QCheckBox* CheckBoxAudio;
34 QCheckBox* CheckBoxImage; 34 QCheckBox* CheckBoxImage;
35 QCheckBox* CheckBoxText; 35 QCheckBox* CheckBoxText;
36 QCheckBox* CheckBoxVideo; 36 QCheckBox* CheckBoxVideo;
37 QCheckBox* AskBox; 37 QCheckBox* AskBox;
38 38
39public: 39public:
40 bool check(); 40 bool check();
41 41
42private: 42private:
43 void startGui(); 43 void startGui();
44 void readConfig(); 44 void readConfig();
45 void writeConfig(); 45 void writeConfig();
46 46
47private slots: 47private slots:
48 void yesPressed(); 48 void yesPressed();
49 void noPressed(); 49 void noPressed();
50private: 50private:
51 QString mediumPath; 51 QString mediumPath;
52 52
53 bool checkagain; 53 bool checkagain;
54 bool checkmimeaudio; 54 bool checkmimeaudio;
55 bool checkmimeimage; 55 bool checkmimeimage;
56 bool checkmimetext; 56 bool checkmimetext;
57 bool checkmimevideo; 57 bool checkmimevideo;
58QString limittodirs; 58QString limittodirs;
59 59
60 60
61}; 61};
62 62
63#endif \ No newline at end of file 63#endif \ No newline at end of file