summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-18 20:08:54 (UTC)
committer zecke <zecke>2004-05-18 20:08:54 (UTC)
commiteb5a5432d79083fdfefb7b9b0c0907abe8807a52 (patch) (unidiff)
tree5dcf20990b122339f63948d3975d1c25b71f8b81
parent8383a8c157825bc1a4c8a13aae7bd66874fe9094 (diff)
downloadopie-eb5a5432d79083fdfefb7b9b0c0907abe8807a52.zip
opie-eb5a5432d79083fdfefb7b9b0c0907abe8807a52.tar.gz
opie-eb5a5432d79083fdfefb7b9b0c0907abe8807a52.tar.bz2
Fix the layout of the KeyConfig Dialog.
The label with 'Default: %1' is now added as MultiCellWidget and now larger keys don't make the 'configure key' button go out of display dimnesion
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/okeyconfigwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.cpp b/libopie2/opieui/okeyconfigwidget.cpp
index 1991381..56f4746 100644
--- a/libopie2/opieui/okeyconfigwidget.cpp
+++ b/libopie2/opieui/okeyconfigwidget.cpp
@@ -87,196 +87,196 @@ namespace Internal {
87 87
88 88
89 89
90 90
91//////////////////////// 91////////////////////////
92//////////////////////// 92////////////////////////
93//////// Widget Starts Here 93//////// Widget Starts Here
94 94
95 95
96 96
97 97
98/** 98/**
99 * 99 *
100 * This is a c'tor. You still need to pass the OKeyConfigManager 100 * This is a c'tor. You still need to pass the OKeyConfigManager
101 * and then issue a load. 101 * and then issue a load.
102 * The default mode is Immediate 102 * The default mode is Immediate
103 * 103 *
104 */ 104 */
105OKeyConfigWidget::OKeyConfigWidget( QWidget* parent, const char *name, WFlags fl ) 105OKeyConfigWidget::OKeyConfigWidget( QWidget* parent, const char *name, WFlags fl )
106 : QWidget( parent, name, fl ) { 106 : QWidget( parent, name, fl ) {
107 initUi(); 107 initUi();
108} 108}
109 109
110 110
111 111
112/** 112/**
113 * c'tor 113 * c'tor
114 */ 114 */
115OKeyConfigWidget::~OKeyConfigWidget() { 115OKeyConfigWidget::~OKeyConfigWidget() {
116} 116}
117 117
118 118
119/** 119/**
120 * @internal 120 * @internal
121 */ 121 */
122void OKeyConfigWidget::initUi() { 122void OKeyConfigWidget::initUi() {
123 QBoxLayout *layout = new QVBoxLayout( this ); 123 QBoxLayout *layout = new QVBoxLayout( this );
124 QGridLayout *gridLay = new QGridLayout( 2, 2 ); 124 QGridLayout *gridLay = new QGridLayout( 2, 2 );
125 layout->addLayout( gridLay, 10 ); 125 layout->addLayout( gridLay, 10 );
126 gridLay->setRowStretch( 1, 10 ); // let only the ListView strecth 126 gridLay->setRowStretch( 1, 10 ); // let only the ListView strecth
127 127
128/* 128/*
129 * LISTVIEW with the Keys 129 * LISTVIEW with the Keys
130 */ 130 */
131 m_view = new Opie::Ui::OListView( this ); 131 m_view = new Opie::Ui::OListView( this );
132 m_view->setFocus(); 132 m_view->setFocus();
133 m_view->setAllColumnsShowFocus( true ); 133 m_view->setAllColumnsShowFocus( true );
134 m_view->addColumn( tr("Pixmap") ); 134 m_view->addColumn( tr("Pixmap") );
135 m_view->addColumn( tr("Name","Name of the Action in the ListView Header" ) ); 135 m_view->addColumn( tr("Name","Name of the Action in the ListView Header" ) );
136 m_view->addColumn( tr("Key" ) ); 136 m_view->addColumn( tr("Key" ) );
137 m_view->addColumn( tr("Default Key" ) ); 137 m_view->addColumn( tr("Default Key" ) );
138 m_view->setRootIsDecorated( true ); 138 m_view->setRootIsDecorated( true );
139 connect(m_view, SIGNAL(currentChanged(QListViewItem*)), 139 connect(m_view, SIGNAL(currentChanged(QListViewItem*)),
140 this, SLOT(slotListViewItem(QListViewItem*)) ); 140 this, SLOT(slotListViewItem(QListViewItem*)) );
141 141
142 gridLay->addMultiCellWidget( m_view, 1, 1, 0, 1 ); 142 gridLay->addMultiCellWidget( m_view, 1, 1, 0, 1 );
143 143
144/* 144/*
145 * GROUP with button info 145 * GROUP with button info
146 */ 146 */
147 147
148 QGroupBox *box = new QGroupBox( this ); 148 QGroupBox *box = new QGroupBox( this );
149 box ->setTitle( tr("Shortcut for Selected Action") ); 149 box ->setTitle( tr("Shortcut for Selected Action") );
150 box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); 150 box ->setFrameStyle( QFrame::Box | QFrame::Sunken );
151 layout->addWidget( box, 1 ); 151 layout->addWidget( box, 1 );
152 152
153 gridLay = new QGridLayout( box, 3, 4 ); 153 gridLay = new QGridLayout( box, 3, 4 );
154 gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); 154 gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() );
155 gridLay->setMargin( 4 ); 155 gridLay->setMargin( 4 );
156 156
157 QButtonGroup *gr = new QButtonGroup( box ); 157 QButtonGroup *gr = new QButtonGroup( box );
158 gr->hide(); 158 gr->hide();
159 gr->setExclusive( true ); 159 gr->setExclusive( true );
160 160
161 QRadioButton *rad = new QRadioButton( tr( "&None" ), box ); 161 QRadioButton *rad = new QRadioButton( tr( "&None" ), box );
162 connect( rad, SIGNAL(clicked()), 162 connect( rad, SIGNAL(clicked()),
163 this, SLOT(slotNoKey()) ); 163 this, SLOT(slotNoKey()) );
164 gr->insert( rad, 10 ); 164 gr->insert( rad, 10 );
165 gridLay->addWidget( rad, 1, 0 ); 165 gridLay->addWidget( rad, 1, 0 );
166 m_none = rad; 166 m_none = rad;
167 167
168 rad = new QRadioButton( tr("&Default" ), box ); 168 rad = new QRadioButton( tr("&Default" ), box );
169 connect( rad, SIGNAL(clicked()), 169 connect( rad, SIGNAL(clicked()),
170 this, SLOT(slotDefaultKey()) ); 170 this, SLOT(slotDefaultKey()) );
171 gr->insert( rad, 11 ); 171 gr->insert( rad, 11 );
172 gridLay->addWidget( rad, 1, 1 ); 172 gridLay->addWidget( rad, 1, 1 );
173 m_def = rad; 173 m_def = rad;
174 174
175 rad = new QRadioButton( tr("C&ustom"), box ); 175 rad = new QRadioButton( tr("C&ustom"), box );
176 connect( rad, SIGNAL(clicked()), 176 connect( rad, SIGNAL(clicked()),
177 this, SLOT(slotCustomKey()) ); 177 this, SLOT(slotCustomKey()) );
178 gr->insert( rad, 12 ); 178 gr->insert( rad, 12 );
179 gridLay->addWidget( rad, 1, 2 ); 179 gridLay->addWidget( rad, 1, 2 );
180 m_cus = rad; 180 m_cus = rad;
181 181
182 m_btn = new QPushButton( tr("Configure Key"), box ); 182 m_btn = new QPushButton( tr("Configure Key"), box );
183 gridLay->addWidget( m_btn, 1, 4 ); 183 gridLay->addWidget( m_btn, 1, 3 );
184 184
185 m_lbl= new QLabel( tr( "Default: " ), box ); 185 m_lbl= new QLabel( tr( "Default: " ), box );
186 gridLay->addWidget( m_lbl, 2, 0 ); 186 gridLay->addMultiCellWidget( m_lbl, 2, 2, 0, 3 );
187 187
188 connect(m_btn, SIGNAL(clicked()), 188 connect(m_btn, SIGNAL(clicked()),
189 this, SLOT(slotConfigure())); 189 this, SLOT(slotConfigure()));
190 190
191 m_box = box; 191 m_box = box;
192} 192}
193 193
194/** 194/**
195 * Set the ChangeMode. 195 * Set the ChangeMode.
196 * You need to call this function prior to load 196 * You need to call this function prior to load
197 * If you call this function past load the behaviour is undefined 197 * If you call this function past load the behaviour is undefined
198 * But caling load again is safe 198 * But caling load again is safe
199 */ 199 */
200void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { 200void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) {
201 m_mode = mode; 201 m_mode = mode;
202} 202}
203 203
204 204
205/** 205/**
206 * return the current mode 206 * return the current mode
207 */ 207 */
208OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { 208OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const {
209 return m_mode; 209 return m_mode;
210} 210}
211 211
212 212
213/** 213/**
214 * insert these items before calling load 214 * insert these items before calling load
215 */ 215 */
216void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { 216void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) {
217 Opie::Ui::Internal::OKeyConfigWidgetPrivate root( str, man ); 217 Opie::Ui::Internal::OKeyConfigWidgetPrivate root( str, man );
218 m_list.append(root); 218 m_list.append(root);
219} 219}
220 220
221 221
222/** 222/**
223 * loads the items and allows editing them 223 * loads the items and allows editing them
224 */ 224 */
225void OKeyConfigWidget::load() { 225void OKeyConfigWidget::load() {
226 Opie::Ui::Internal::OKeyConfigWidgetPrivateList::Iterator it; 226 Opie::Ui::Internal::OKeyConfigWidgetPrivateList::Iterator it;
227 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 227 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
228 OListViewItem *item = new OListViewItem( m_view, (*it).name ); 228 OListViewItem *item = new OListViewItem( m_view, (*it).name );
229 OKeyConfigItem::List list = (*it).manager->keyConfigList(); 229 OKeyConfigItem::List list = (*it).manager->keyConfigList();
230 for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) 230 for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt )
231 (void )new Opie::Ui::Internal::OKeyListViewItem(*keyIt, (*it).manager, item ); 231 (void )new Opie::Ui::Internal::OKeyListViewItem(*keyIt, (*it).manager, item );
232 232
233 } 233 }
234} 234}
235 235
236/** 236/**
237 * Saves if in Queue Mode. It'll update the supplied 237 * Saves if in Queue Mode. It'll update the supplied
238 * OKeyConfigManager objects. 238 * OKeyConfigManager objects.
239 * If in Queue mode it'll just return 239 * If in Queue mode it'll just return
240 */ 240 */
241void OKeyConfigWidget::save() { 241void OKeyConfigWidget::save() {
242 /* 242 /*
243 * Iterate over all config items 243 * Iterate over all config items
244 */ 244 */
245 QListViewItemIterator it( m_view ); 245 QListViewItemIterator it( m_view );
246 while ( it.current() ) { 246 while ( it.current() ) {
247 if (it.current()->parent() ) { 247 if (it.current()->parent() ) {
248 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( it.current() ); 248 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( it.current() );
249 OKeyConfigManager *man = item->manager(); 249 OKeyConfigManager *man = item->manager();
250 man->removeKeyConfig( item->origItem() ); 250 man->removeKeyConfig( item->origItem() );
251 man->addKeyConfig( item->item() ); 251 man->addKeyConfig( item->item() );
252 } 252 }
253 ++it; 253 ++it;
254 } 254 }
255 255
256 256
257} 257}
258 258
259 259
260/** 260/**
261 * @internal 261 * @internal
262 */ 262 */
263void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) { 263void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) {
264 if ( !_item || !_item->parent() ) { 264 if ( !_item || !_item->parent() ) {
265 m_box->setEnabled( false ); 265 m_box->setEnabled( false );
266 m_none->setChecked( true ); 266 m_none->setChecked( true );
267 m_btn ->setEnabled( false ); 267 m_btn ->setEnabled( false );
268 m_def ->setChecked( false ); 268 m_def ->setChecked( false );
269 m_cus ->setChecked( false ); 269 m_cus ->setChecked( false );
270 }else{ 270 }else{
271 m_box->setEnabled( true ); 271 m_box->setEnabled( true );
272 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( _item ); 272 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( _item );
273 OKeyConfigItem keyItem= item->item(); 273 OKeyConfigItem keyItem= item->item();
274 m_lbl->setText( tr("Default: " )+ item->text( 3 ) ); 274 m_lbl->setText( tr("Default: " )+ item->text( 3 ) );
275 if ( keyItem.keyPair().isEmpty() ) { 275 if ( keyItem.keyPair().isEmpty() ) {
276 m_none->setChecked( true ); 276 m_none->setChecked( true );
277 m_btn ->setEnabled( false ); 277 m_btn ->setEnabled( false );
278 m_def ->setChecked( false ); 278 m_def ->setChecked( false );
279 m_cus ->setChecked( false ); 279 m_cus ->setChecked( false );
280 }else { 280 }else {
281 m_none->setChecked( false ); 281 m_none->setChecked( false );
282 m_cus ->setChecked( true ); 282 m_cus ->setChecked( true );