~ubuntu-branches/ubuntu/trusty/krusader/trusty

« back to all changes in this revision

Viewing changes to krusader/Locate/locate.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-08-08 13:47:36 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20110808134736-8e630ivgd2c3sgg5
Tags: 1:2.4.0~beta1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
    setDefaultButton(KDialog::User3);
121
121
    setWindowTitle(i18n("Locate"));
122
122
    setWindowModality(Qt::NonModal);
123
 
    setButtonGuiItem(KDialog::User1, KGuiItem(i18n("Stop")));
124
123
    setButtonGuiItem(KDialog::User2, KGuiItem(i18n("Update DB")));
125
 
    setButtonGuiItem(KDialog::User3, KGuiItem(i18n("Locate")));
 
124
    setButtonGuiItem(KDialog::User3, KGuiItem(i18n("Locate"), "system-search"));
126
125
 
127
126
    QWidget *widget = new QWidget(this);
128
127
    QGridLayout *grid = new QGridLayout(widget);
186
185
    resultList->setColumnWidth(0, QFontMetrics(resultList->font()).width("W") * 60);
187
186
 
188
187
    KConfigGroup gl(krConfig, "Look&Feel");
189
 
    resultList->setFont(gl.readEntry("Filelist Font", *_FilelistFont));
 
188
    resultList->setFont(gl.readEntry("Filelist Font", _FilelistFont));
190
189
 
191
190
    resultList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
192
191
    resultList->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
211
210
    line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
212
211
    grid->addWidget(line2, 4, 0);
213
212
 
214
 
    enableButton(KDialog::User1, false);    /* disable the stop button */
 
213
    updateButtons(false);
215
214
 
216
215
    if (updateProcess) {
217
216
        if (updateProcess->state() == QProcess::Running) {
277
276
    lastItem = 0;
278
277
    remaining = "";
279
278
 
280
 
    enableButton(KDialog::User3, false);    /* disable the locate button */
281
 
    enableButton(KDialog::User1, true);     /* enable the stop button */
282
 
    setButtonText(KDialog::User1, i18n("Stop"));     /* the button behaves as stop */
 
279
    updateButtons(true);
 
280
 
283
281
    isFeedToListBox = false;
284
282
    resultList->setFocus();
285
283
 
286
 
    qApp->processEvents();
 
284
    qApp->processEvents(); //FIXME - whats's this for ?
287
285
 
288
286
    locateProc = new KProcess(this);
289
287
    locateProc->setOutputChannelMode(KProcess::SeparateChannels); // default is forwarding to the parent channels
318
316
        if (!collectedErr.isEmpty())
319
317
            KMessageBox::error(krMainWindow, i18n("Locate produced the following error message:\n\n") + collectedErr);
320
318
    }
321
 
    enableButton(KDialog::User3, true);    /* enable the locate button */
322
319
 
323
320
    if (resultList->topLevelItemCount() == 0) {
324
321
        locateSearchFor->setFocus();
325
 
        enableButton(KDialog::User1, false);   /* disable the stop button */
326
322
        isFeedToListBox = false;
327
323
    } else {
328
 
        setButtonText(KDialog::User1, i18n("Feed to listbox"));   /* feed to listbox */
329
324
        isFeedToListBox = true;
330
325
    }
 
326
 
 
327
    updateButtons(false);
331
328
}
332
329
 
333
330
void LocateDlg::processStdout()
662
659
    locateSearchFor->lineEdit()->selectAll();
663
660
}
664
661
 
 
662
void LocateDlg::updateButtons(bool locateIsRunning)
 
663
{
 
664
    enableButton(KDialog::User3, !locateIsRunning);    /* locate button */
 
665
 
 
666
    if (locateIsRunning) {
 
667
        setButtonGuiItem(KDialog::User1, KGuiItem(i18n("Stop"), "process-stop"));
 
668
        enableButton(KDialog::User1, true);     /* enable the stop button */
 
669
    } else {
 
670
        if (resultList->topLevelItemCount() == 0) {
 
671
            setButtonGuiItem(KDialog::User1, KGuiItem(i18n("Stop"), "process-stop"));
 
672
            enableButton(KDialog::User1, false);   /* disable the stop button */
 
673
        } else {
 
674
            setButtonGuiItem(KDialog::User1, KGuiItem(i18n("Feed to listbox"), "list-add"));   /* feed to listbox */
 
675
            enableButton(KDialog::User1, true);    /* enable the Feed to listbox button */
 
676
        }
 
677
    }
 
678
}
 
679
 
665
680
#include "locate.moc"