summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/mediummount/mediumglobal.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc
index 1f90497..fa4171c 100644
--- a/noncore/settings/mediummount/mediumglobal.cc
+++ b/noncore/settings/mediummount/mediumglobal.cc
@@ -1,170 +1,169 @@
1 1
2 2
3#include <qlineedit.h> 3#include <qlineedit.h>
4#include <qcheckbox.h> 4#include <qcheckbox.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qabstractlayout.h> // spacer item 6#include <qabstractlayout.h> // spacer item
7#include <qlayout.h> 7#include <qlayout.h>
8#include <qframe.h> 8#include <qframe.h>
9#include <qgroupbox.h> 9#include <qgroupbox.h>
10#include <qwhatsthis.h> 10#include <qwhatsthis.h>
11 11
12#include <qpe/config.h> 12#include <qpe/config.h>
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 )
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, ("If a medium gets inserted into this device Opie " 36 QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie "
37 "tries to search the medium for Documents. On " 37 "tries to search the medium for Documents. On "
38 "large mediums this can take some time. You can choose " 38 "large mediums this can take some time. You can choose "
39 "if Opie should scan for Documents globally or on a " 39 "if Opie should scan for Documents globally or on a "
40 "per medium level. You're also able to reconfigure " 40 "per medium level. You're also able to reconfigure "
41 "each medium." 41 "each medium.") );
42 ) );
43 42
44 m_layout->addWidget( m_label ); 43 m_layout->addWidget( m_label );
45 44
46 m_check = new QCheckBox( tr("Enable medium checking" ), this ); 45 m_check = new QCheckBox( tr("Enable medium checking" ), this );
47 connect( m_check, SIGNAL(stateChanged(int) ), 46 connect( m_check, SIGNAL(stateChanged(int) ),
48 this, SLOT(slotEnableChecking() ) ); 47 this, SLOT(slotEnableChecking() ) );
49 m_layout->addWidget(m_check ); 48 m_layout->addWidget(m_check );
50 49
51 m_frame = new QFrame(this, "Frame" ); 50 m_frame = new QFrame(this, "Frame" );
52 m_frame->setFrameShape( QFrame::Box ); 51 m_frame->setFrameShape( QFrame::Box );
53 m_frame->setFrameShadow( QFrame::Sunken ); 52 m_frame->setFrameShadow( QFrame::Sunken );
54 53
55 m_box = new QVBoxLayout( m_frame ); 54 m_box = new QVBoxLayout( m_frame );
56 m_box->setMargin( 5 ); 55 m_box->setMargin( 5 );
57 m_useglobal = new QCheckBox( tr("Use global settings"), m_frame ); 56 m_useglobal = new QCheckBox( tr("Use global settings"), m_frame );
58 connect( m_useglobal, SIGNAL( stateChanged(int) ), 57 connect( m_useglobal, SIGNAL( stateChanged(int) ),
59 this, SLOT( slotGlobalChanged() ) ); 58 this, SLOT( slotGlobalChanged() ) );
60 59
61 m_box->addWidget( m_useglobal ); 60 m_box->addWidget( m_useglobal );
62 61
63 m_global = new QGroupBox( tr("Which media files"), m_frame ); 62 m_global = new QGroupBox( tr("Which media files"), m_frame );
64 m_frameLay = new QGridLayout(m_global, 4, 3 ); 63 m_frameLay = new QGridLayout(m_global, 4, 3 );
65 m_frameLay->setMargin( 12 ); 64 m_frameLay->setMargin( 12 );
66 65
67 QSpacerItem *item2 = new QSpacerItem( 5, 8, 66 QSpacerItem *item2 = new QSpacerItem( 5, 8,
68 QSizePolicy::Fixed, 67 QSizePolicy::Fixed,
69 QSizePolicy::Fixed ); 68 QSizePolicy::Fixed );
70 m_audio = new QCheckBox( tr("Audio"), m_global ); 69 m_audio = new QCheckBox( tr("Audio"), m_global );
71 m_all = new QCheckBox( tr("All") , m_global ); 70 m_all = new QCheckBox( tr("All") , m_global );
72 m_image = new QCheckBox( tr("Image"), m_global ); 71 m_image = new QCheckBox( tr("Image"), m_global );
73 m_text = new QCheckBox( tr("Text") , m_global ); 72 m_text = new QCheckBox( tr("Text") , m_global );
74 m_video = new QCheckBox( tr("Video"), m_global ); 73 m_video = new QCheckBox( tr("Video"), m_global );
75 74
76 connect(m_all, SIGNAL(stateChanged(int) ), 75 connect(m_all, SIGNAL(stateChanged(int) ),
77 this, SLOT(slotAllChanged() ) ); 76 this, SLOT(slotAllChanged() ) );
78 77
79 m_frameLay->addItem( item2, 0, 0 ); 78 m_frameLay->addItem( item2, 0, 0 );
80 79
81 m_frameLay->addWidget( m_audio, 1, 0 ); 80 m_frameLay->addWidget( m_audio, 1, 0 );
82 m_frameLay->addWidget( m_image, 2, 0 ); 81 m_frameLay->addWidget( m_image, 2, 0 );
83 m_frameLay->addWidget( m_all, 3, 0 ); 82 m_frameLay->addWidget( m_all, 3, 0 );
84 83
85 m_frameLay->addWidget( m_text, 1, 2 ); 84 m_frameLay->addWidget( m_text, 1, 2 );
86 m_frameLay->addWidget( m_video, 2, 2 ); 85 m_frameLay->addWidget( m_video, 2, 2 );
87 86
88 m_frameLay->addRowSpacing( 0, 8 ); 87 m_frameLay->addRowSpacing( 0, 8 );
89 m_frameLay->addColSpacing( 1, 2 ); 88 m_frameLay->addColSpacing( 1, 2 );
90 89
91 m_box->addWidget( m_global ); 90 m_box->addWidget( m_global );
92 91
93 92
94 m_layout->addWidget( m_frame ); 93 m_layout->addWidget( m_frame );
95 94
96 QSpacerItem *item1 = new QSpacerItem( 1, 24, 95 QSpacerItem *item1 = new QSpacerItem( 1, 24,
97 QSizePolicy::Fixed, 96 QSizePolicy::Fixed,
98 QSizePolicy::Expanding ); 97 QSizePolicy::Expanding );
99 m_layout->addItem( item1 ); 98 m_layout->addItem( item1 );
100} 99}
101void MediumGlobalWidget::readConfig() 100void MediumGlobalWidget::readConfig()
102{ 101{
103 if( m_config == 0 ) 102 if( m_config == 0 )
104 m_config = new Config("medium" ); 103 m_config = new Config("medium" );
105 104
106 m_config->setGroup("main"); 105 m_config->setGroup("main");
107 m_useglobal->setChecked( m_config->readBoolEntry("global", false ) ); 106 m_useglobal->setChecked( m_config->readBoolEntry("global", false ) );
108 m_check->setChecked( m_config->readBoolEntry("use", true ) ); 107 m_check->setChecked( m_config->readBoolEntry("use", true ) );
109 108
110 m_config->setGroup("mimetypes" ); 109 m_config->setGroup("mimetypes" );
111 m_all->setChecked ( m_config->readBoolEntry("all", false ) ); 110 m_all->setChecked ( m_config->readBoolEntry("all", false ) );
112 m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); 111 m_audio->setChecked( m_config->readBoolEntry("audio", true ) );
113 m_video->setChecked( m_config->readBoolEntry("video", true ) ); 112 m_video->setChecked( m_config->readBoolEntry("video", true ) );
114 m_text->setChecked ( m_config->readBoolEntry("text", true ) ); 113 m_text->setChecked ( m_config->readBoolEntry("text", true ) );
115 m_image->setChecked( m_config->readBoolEntry("image", true ) ); 114 m_image->setChecked( m_config->readBoolEntry("image", true ) );
116 115
117 slotAllChanged(); 116 slotAllChanged();
118 slotEnableChecking(); 117 slotEnableChecking();
119 slotGlobalChanged(); 118 slotGlobalChanged();
120 if( m_all->isChecked() ){ 119 if( m_all->isChecked() ){
121 m_video->setEnabled( false ); 120 m_video->setEnabled( false );
122 m_text->setEnabled( false ); 121 m_text->setEnabled( false );
123 m_audio->setEnabled( false ); 122 m_audio->setEnabled( false );
124 m_image->setEnabled( false ); 123 m_image->setEnabled( false );
125 124
126 } 125 }
127} 126}
128void MediumGlobalWidget::writeConfig() 127void MediumGlobalWidget::writeConfig()
129{ 128{
130 m_config->setGroup( "main" ); 129 m_config->setGroup( "main" );
131 m_config->writeEntry("global", m_useglobal->isChecked() ); 130 m_config->writeEntry("global", m_useglobal->isChecked() );
132 m_config->writeEntry("use", m_check->isChecked() ); 131 m_config->writeEntry("use", m_check->isChecked() );
133 132
134 m_config->setGroup("mimetypes" ); 133 m_config->setGroup("mimetypes" );
135 134
136 m_config->writeEntry("all", m_all->isChecked() ); 135 m_config->writeEntry("all", m_all->isChecked() );
137 m_config->writeEntry("audio", m_audio->isChecked() ); 136 m_config->writeEntry("audio", m_audio->isChecked() );
138 m_config->writeEntry("video", m_video->isChecked() ); 137 m_config->writeEntry("video", m_video->isChecked() );
139 m_config->writeEntry("text", m_text->isChecked() ); 138 m_config->writeEntry("text", m_text->isChecked() );
140 m_config->writeEntry("image", m_image->isChecked() ); 139 m_config->writeEntry("image", m_image->isChecked() );
141} 140}
142MediumGlobalWidget::~MediumGlobalWidget() 141MediumGlobalWidget::~MediumGlobalWidget()
143{ 142{
144 writeConfig(); 143 writeConfig();
145 delete m_config; 144 delete m_config;
146} 145}
147void MediumGlobalWidget::slotGlobalChanged() 146void MediumGlobalWidget::slotGlobalChanged()
148{ 147{
149 int mode = GLOBAL_DISABLED; 148 int mode = GLOBAL_DISABLED;
150 bool enabled = false; 149 bool enabled = false;
151 if( ( enabled =m_useglobal->isChecked() ) ){ 150 if( ( enabled =m_useglobal->isChecked() ) ){
152 mode = GLOBAL_ENABLED; 151 mode = GLOBAL_ENABLED;
153 }else 152 }else
154 mode = GLOBAL_DISABLED; 153 mode = GLOBAL_DISABLED;
155 qWarning("enabled = %d", enabled ); 154 qWarning("enabled = %d", enabled );
156 m_all->setEnabled ( enabled ); 155 m_all->setEnabled ( enabled );
157 m_audio->setEnabled( enabled ); 156 m_audio->setEnabled( enabled );
158 m_image->setEnabled( enabled ); 157 m_image->setEnabled( enabled );
159 m_text->setEnabled ( enabled ); 158 m_text->setEnabled ( enabled );
160 m_video->setEnabled ( enabled ); 159 m_video->setEnabled ( enabled );
161 slotAllChanged(); 160 slotAllChanged();
162 161
163 emit globalStateChanged( mode ); 162 emit globalStateChanged( mode );
164} 163}
165void MediumGlobalWidget::slotEnableChecking() 164void MediumGlobalWidget::slotEnableChecking()
166{ 165{
167 int mode = ENABLE_CHECKS; 166 int mode = ENABLE_CHECKS;
168 bool enabled = false; 167 bool enabled = false;
169 if( ( enabled = m_check->isChecked() ) ){ 168 if( ( enabled = m_check->isChecked() ) ){
170 mode = ENABLE_CHECKS; 169 mode = ENABLE_CHECKS;