comparison multichoicedialog.cpp @ 199:f16fe0db11f3

* Add "Show All Files" toggle to show ignored and clean files * Clear selection when Esc is pressed * Don't delete and recreate the filesystem watcher on stat, just update it
author Chris Cannam
date Mon, 03 Jan 2011 22:02:08 +0000
parents 01580704de3e
children 3d4291d4226c
comparison
equal deleted inserted replaced
198:4adbd5c9c15d 199:f16fe0db11f3
82 connect(bbox, SIGNAL(accepted()), this, SLOT(accept())); 82 connect(bbox, SIGNAL(accepted()), this, SLOT(accept()));
83 connect(bbox, SIGNAL(rejected()), this, SLOT(reject())); 83 connect(bbox, SIGNAL(rejected()), this, SLOT(reject()));
84 outer->addWidget(bbox, 5, 0, 1, 3); 84 outer->addWidget(bbox, 5, 0, 1, 3);
85 85
86 m_okButton = bbox->button(QDialogButtonBox::Ok); 86 m_okButton = bbox->button(QDialogButtonBox::Ok);
87 m_okButton->setEnabled(false); 87 updateOkButton();
88 88
89 setMinimumWidth(480); 89 setMinimumWidth(480);
90 } 90 }
91 91
92 QString 92 QString
201 } 201 }
202 202
203 void 203 void
204 MultiChoiceDialog::urlChanged(const QString &s) 204 MultiChoiceDialog::urlChanged(const QString &s)
205 { 205 {
206 updateOkButton();
207 }
208
209 void
210 MultiChoiceDialog::fileChanged(const QString &s)
211 {
212 updateOkButton();
213 }
214
215 void
216 MultiChoiceDialog::updateOkButton()
217 {
206 /* This doesn't work well 218 /* This doesn't work well
207 if (m_argTypes[m_currentChoice] != UrlToDirectoryArg) { 219 if (m_argTypes[m_currentChoice] != UrlToDirectoryArg) {
208 return; 220 return;
209 } 221 }
210 QDir dirPath(m_fileCombo->currentText()); 222 QDir dirPath(m_fileCombo->currentText());
220 if (urlDirName == "" || urlDirName == url) { 232 if (urlDirName == "" || urlDirName == url) {
221 return; 233 return;
222 } 234 }
223 m_fileCombo->lineEdit()->setText(dirPath.filePath(urlDirName)); 235 m_fileCombo->lineEdit()->setText(dirPath.filePath(urlDirName));
224 */ 236 */
225 if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) {
226 m_okButton->setEnabled(getArgument() != "" &&
227 getAdditionalArgument() != "");
228 } else {
229 m_okButton->setEnabled(getArgument() != "");
230 }
231 }
232
233 void
234 MultiChoiceDialog::fileChanged(const QString &s)
235 {
236 if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) { 237 if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) {
237 m_okButton->setEnabled(getArgument() != "" && 238 m_okButton->setEnabled(getArgument() != "" &&
238 getAdditionalArgument() != ""); 239 getAdditionalArgument() != "");
239 } else { 240 } else {
240 m_okButton->setEnabled(getArgument() != ""); 241 m_okButton->setEnabled(getArgument() != "");
321 m_fileCombo->lineEdit()->setText(QDir::homePath()); 322 m_fileCombo->lineEdit()->setText(QDir::homePath());
322 m_browseButton->show(); 323 m_browseButton->show();
323 break; 324 break;
324 } 325 }
325 326
327 updateOkButton();
326 adjustSize(); 328 adjustSize();
327 } 329 }
328 330
329 331