Switch to unified view

a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp
...
...
195
    }
195
    }
196
    QAction *curid = prefs.queryStemLang == "ALL" ? m_idAllStem : m_idNoStem;
196
    QAction *curid = prefs.queryStemLang == "ALL" ? m_idAllStem : m_idNoStem;
197
    QAction *id; 
197
    QAction *id; 
198
    for (vector<string>::const_iterator it = langs.begin(); 
198
    for (vector<string>::const_iterator it = langs.begin(); 
199
     it != langs.end(); it++) {
199
     it != langs.end(); it++) {
200
    QString qlang = QString::fromAscii(it->c_str(), it->length());
200
    QString qlang = QString::fromUtf8(it->c_str(), it->length());
201
    id = preferencesMenu->addAction(qlang);
201
    id = preferencesMenu->addAction(qlang);
202
    id->setCheckable(true);
202
    id->setCheckable(true);
203
    m_stemLangToId[qlang] = id;
203
    m_stemLangToId[qlang] = id;
204
    if (prefs.queryStemLang == qlang) {
204
    if (prefs.queryStemLang == qlang) {
205
        curid = id;
205
        curid = id;
...
...
220
    this->addToolBar(int2area(prefs.resArea), m_resTB);
220
    this->addToolBar(int2area(prefs.resArea), m_resTB);
221
221
222
    // Document filter buttons and combobox
222
    // Document filter buttons and combobox
223
    // Combobox version of the document filter control
223
    // Combobox version of the document filter control
224
    m_filtCMB = new QComboBox(m_resTB);
224
    m_filtCMB = new QComboBox(m_resTB);
225
    m_filtCMB->setEditable(FALSE);
225
    m_filtCMB->setEditable(false);
226
    m_filtCMB->addItem(tr("All"));
226
    m_filtCMB->addItem(tr("All"));
227
    m_filtCMB->setToolTip(tr("Document filter"));
227
    m_filtCMB->setToolTip(tr("Document filter"));
228
    // Buttons version of the document filter control
228
    // Buttons version of the document filter control
229
    m_filtFRM = new QFrame(this);
229
    m_filtFRM = new QFrame(this);
230
    m_filtFRM->setObjectName(QString::fromUtf8("m_filtFRM"));
230
    m_filtFRM->setObjectName(QString::fromUtf8("m_filtFRM"));
...
...
447
        m_trayicon->show();
447
        m_trayicon->show();
448
    } else {
448
    } else {
449
        m_trayicon = 0;
449
        m_trayicon = 0;
450
    }
450
    }
451
451
452
    fileRebuildIndexAction->setEnabled(FALSE);
452
    fileRebuildIndexAction->setEnabled(false);
453
    fileToggleIndexingAction->setEnabled(FALSE);
453
    fileToggleIndexingAction->setEnabled(false);
454
    // Start timer on a slow period (used for checking ^C). Will be
454
    // Start timer on a slow period (used for checking ^C). Will be
455
    // speeded up during indexing
455
    // speeded up during indexing
456
    periodictimer->start(1000);
456
    periodictimer->start(1000);
457
}
457
}
458
458
...
...
633
    } else {
633
    } else {
634
    lang = id->text();
634
    lang = id->text();
635
    }
635
    }
636
    prefs.queryStemLang = lang;
636
    prefs.queryStemLang = lang;
637
    LOGDEB(("RclMain::setStemLang(%d): lang [%s]\n", 
637
    LOGDEB(("RclMain::setStemLang(%d): lang [%s]\n", 
638
        id, (const char *)prefs.queryStemLang.toAscii()));
638
        id, (const char *)prefs.queryStemLang.toUtf8()));
639
    rwSettings(true);
639
    rwSettings(true);
640
    emit stemLangChanged(lang);
640
    emit stemLangChanged(lang);
641
}
641
}
642
642
643
// Set the checked stemming language item before showing the prefs menu
643
// Set the checked stemming language item before showing the prefs menu
644
void RclMain::setStemLang(const QString& lang)
644
void RclMain::setStemLang(const QString& lang)
645
{
645
{
646
    LOGDEB(("RclMain::setStemLang(%s)\n", (const char *)lang.toAscii()));
646
    LOGDEB(("RclMain::setStemLang(%s)\n", (const char *)lang.toUtf8()));
647
    QAction *id;
647
    QAction *id;
648
    if (lang == "") {
648
    if (lang == "") {
649
    id = m_idNoStem;
649
    id = m_idNoStem;
650
    } else if (lang == "ALL") {
650
    } else if (lang == "ALL") {
651
    id = m_idAllStem;
651
    id = m_idAllStem;
...
...
739
    if (status.dbtotdocs > 0)
739
    if (status.dbtotdocs > 0)
740
        sprintf(cnts,"(%d/%d/%d) ", status.docsdone, status.filesdone, 
740
        sprintf(cnts,"(%d/%d/%d) ", status.docsdone, status.filesdone, 
741
            status.dbtotdocs);
741
            status.dbtotdocs);
742
    else
742
    else
743
        sprintf(cnts, "(%d/%d) ", status.docsdone, status.filesdone);
743
        sprintf(cnts, "(%d/%d) ", status.docsdone, status.filesdone);
744
    msg += QString::fromAscii(cnts) + " ";
744
    msg += QString::fromUtf8(cnts) + " ";
745
    }
745
    }
746
    string mf;int ecnt = 0;
746
    string mf;int ecnt = 0;
747
    string fcharset = theconfig->getDefCharset(true);
747
    string fcharset = theconfig->getDefCharset(true);
748
    if (!transcode(status.fn, mf, fcharset, "UTF-8", &ecnt) || ecnt) {
748
    if (!transcode(status.fn, mf, fcharset, "UTF-8", &ecnt) || ecnt) {
749
    mf = url_encode(status.fn, 0);
749
    mf = url_encode(status.fn, 0);
...
...
790
    // the "start/stop indexing" slot itself
790
    // the "start/stop indexing" slot itself
791
    IndexerState prevstate = m_indexerState;
791
    IndexerState prevstate = m_indexerState;
792
    if (m_idxproc) {
792
    if (m_idxproc) {
793
    m_indexerState = IXST_RUNNINGMINE;
793
    m_indexerState = IXST_RUNNINGMINE;
794
    fileToggleIndexingAction->setText(tr("Stop &Indexing"));
794
    fileToggleIndexingAction->setText(tr("Stop &Indexing"));
795
    fileToggleIndexingAction->setEnabled(TRUE);
795
    fileToggleIndexingAction->setEnabled(true);
796
    fileRebuildIndexAction->setEnabled(FALSE);
796
    fileRebuildIndexAction->setEnabled(false);
797
    periodictimer->setInterval(200);
797
    periodictimer->setInterval(200);
798
    } else {
798
    } else {
799
    Pidfile pidfile(theconfig->getPidfile());
799
    Pidfile pidfile(theconfig->getPidfile());
800
    if (pidfile.open() == 0) {
800
    if (pidfile.open() == 0) {
801
        m_indexerState = IXST_NOTRUNNING;
801
        m_indexerState = IXST_NOTRUNNING;
802
        fileToggleIndexingAction->setText(tr("Update &Index"));
802
        fileToggleIndexingAction->setText(tr("Update &Index"));
803
        fileToggleIndexingAction->setEnabled(TRUE);
803
        fileToggleIndexingAction->setEnabled(true);
804
        fileRebuildIndexAction->setEnabled(TRUE);
804
        fileRebuildIndexAction->setEnabled(true);
805
        periodictimer->setInterval(1000);
805
        periodictimer->setInterval(1000);
806
    } else {
806
    } else {
807
        // Real time or externally started batch indexer running
807
        // Real time or externally started batch indexer running
808
        m_indexerState = IXST_RUNNINGNOTMINE;
808
        m_indexerState = IXST_RUNNINGNOTMINE;
809
        fileToggleIndexingAction->setText(tr("Stop &Indexing"));
809
        fileToggleIndexingAction->setText(tr("Stop &Indexing"));
810
        fileToggleIndexingAction->setEnabled(TRUE);
810
        fileToggleIndexingAction->setEnabled(true);
811
        fileRebuildIndexAction->setEnabled(FALSE);
811
        fileRebuildIndexAction->setEnabled(false);
812
        periodictimer->setInterval(200);
812
        periodictimer->setInterval(200);
813
    }       
813
    }       
814
    }
814
    }
815
815
816
    if ((prevstate == IXST_RUNNINGMINE || prevstate == IXST_RUNNINGNOTMINE)
816
    if ((prevstate == IXST_RUNNINGMINE || prevstate == IXST_RUNNINGNOTMINE)
...
...
1270
    string miss;
1270
    string miss;
1271
    if (!theconfig->getMissingHelperDesc(miss)) {
1271
    if (!theconfig->getMissingHelperDesc(miss)) {
1272
    QMessageBox::information(this, "", tr("Indexing did not run yet"));
1272
    QMessageBox::information(this, "", tr("Indexing did not run yet"));
1273
    return;
1273
    return;
1274
    }
1274
    }
1275
    QString msg = QString::fromAscii("<p>") +
1275
    QString msg = QString::fromUtf8("<p>") +
1276
    tr("External applications/commands needed for your file types "
1276
    tr("External applications/commands needed for your file types "
1277
       "and not found, as stored by the last indexing pass in ");
1277
       "and not found, as stored by the last indexing pass in ");
1278
    msg += "<i>";
1278
    msg += "<i>";
1279
    msg += QString::fromLocal8Bit(theconfig->getConfDir().c_str());
1279
    msg += QString::fromLocal8Bit(theconfig->getConfDir().c_str());
1280
    msg += "/missing</i>:<pre>\n";
1280
    msg += "/missing</i>:<pre>\n";
...
...
1345
    dialog.groupBox->setTitle(tr("Content has been indexed for these mime types:"));
1345
    dialog.groupBox->setTitle(tr("Content has been indexed for these mime types:"));
1346
1346
1347
    // We replace the list with an editor so that the user can copy/paste
1347
    // We replace the list with an editor so that the user can copy/paste
1348
    delete dialog.listWidget;
1348
    delete dialog.listWidget;
1349
    QTextEdit *editor = new QTextEdit(dialog.groupBox);
1349
    QTextEdit *editor = new QTextEdit(dialog.groupBox);
1350
    editor->setReadOnly(TRUE);
1350
    editor->setReadOnly(true);
1351
    dialog.horizontalLayout->addWidget(editor);
1351
    dialog.horizontalLayout->addWidget(editor);
1352
1352
1353
    for (set<string>::const_iterator it = mtypesfromdbconf.begin(); 
1353
    for (set<string>::const_iterator it = mtypesfromdbconf.begin(); 
1354
     it != mtypesfromdbconf.end(); it++) {
1354
     it != mtypesfromdbconf.end(); it++) {
1355
    editor->append(QString::fromAscii(it->c_str()));
1355
    editor->append(QString::fromUtf8(it->c_str()));
1356
    }
1356
    }
1357
    editor->moveCursor(QTextCursor::Start);
1357
    editor->moveCursor(QTextCursor::Start);
1358
    editor->ensureCursorVisible();
1358
    editor->ensureCursorVisible();
1359
    dialog.exec();
1359
    dialog.exec();
1360
}
1360
}
...
...
1526
    args.insert(args.end(), paths.begin(), paths.end());
1526
    args.insert(args.end(), paths.begin(), paths.end());
1527
    m_idxproc = new ExecCmd;
1527
    m_idxproc = new ExecCmd;
1528
    m_idxproc->startExec("recollindex", args, false, false);
1528
    m_idxproc->startExec("recollindex", args, false, false);
1529
    fileToggleIndexingAction->setText(tr("Stop &Indexing"));
1529
    fileToggleIndexingAction->setText(tr("Stop &Indexing"));
1530
    }
1530
    }
1531
    fileToggleIndexingAction->setEnabled(FALSE);
1531
    fileToggleIndexingAction->setEnabled(false);
1532
}
1532
}
1533
1533
1534
/** 
1534
/** 
1535
 * Open a preview window for a given document, no linking to result list
1535
 * Open a preview window for a given document, no linking to result list
1536
 *
1536
 *
...
...
1771
    dialog.groupBox->setTitle(tr("These Urls ( | ipath) share the same"
1771
    dialog.groupBox->setTitle(tr("These Urls ( | ipath) share the same"
1772
                 " content:"));
1772
                 " content:"));
1773
    // We replace the list with an editor so that the user can copy/paste
1773
    // We replace the list with an editor so that the user can copy/paste
1774
    delete dialog.listWidget;
1774
    delete dialog.listWidget;
1775
    QTextEdit *editor = new QTextEdit(dialog.groupBox);
1775
    QTextEdit *editor = new QTextEdit(dialog.groupBox);
1776
    editor->setReadOnly(TRUE);
1776
    editor->setReadOnly(true);
1777
    dialog.horizontalLayout->addWidget(editor);
1777
    dialog.horizontalLayout->addWidget(editor);
1778
1778
1779
    for (vector<Rcl::Doc>::const_iterator it = dups.begin(); 
1779
    for (vector<Rcl::Doc>::const_iterator it = dups.begin(); 
1780
     it != dups.end(); it++) {
1780
     it != dups.end(); it++) {
1781
    if (it->ipath.empty()) 
1781
    if (it->ipath.empty()) 
...
...
1837
    vector<string> lcmd;
1837
    vector<string> lcmd;
1838
    if (!stringToStrings(cmdspec, lcmd)) {
1838
    if (!stringToStrings(cmdspec, lcmd)) {
1839
    QMessageBox::warning(0, "Recoll", 
1839
    QMessageBox::warning(0, "Recoll", 
1840
                 tr("Bad desktop app spec for %1: [%2]\n"
1840
                 tr("Bad desktop app spec for %1: [%2]\n"
1841
                "Please check the desktop file")
1841
                "Please check the desktop file")
1842
                 .arg(QString::fromAscii(doc.mimetype.c_str()))
1842
                 .arg(QString::fromUtf8(doc.mimetype.c_str()))
1843
                 .arg(QString::fromLocal8Bit(cmdspec.c_str())));
1843
                 .arg(QString::fromLocal8Bit(cmdspec.c_str())));
1844
    return;
1844
    return;
1845
    }
1845
    }
1846
1846
1847
    // Look for the command to execute in the exec path and the filters 
1847
    // Look for the command to execute in the exec path and the filters 
...
...
1894
    vector<string> lcmd;
1894
    vector<string> lcmd;
1895
    if (!stringToStrings(cmd, lcmd)) {
1895
    if (!stringToStrings(cmd, lcmd)) {
1896
    QMessageBox::warning(0, "Recoll", 
1896
    QMessageBox::warning(0, "Recoll", 
1897
                 tr("Bad viewer command line for %1: [%2]\n"
1897
                 tr("Bad viewer command line for %1: [%2]\n"
1898
                "Please check the mimeview file")
1898
                "Please check the mimeview file")
1899
                 .arg(QString::fromAscii(doc.mimetype.c_str()))
1899
                 .arg(QString::fromUtf8(doc.mimetype.c_str()))
1900
                 .arg(QString::fromLocal8Bit(cmd.c_str())));
1900
                 .arg(QString::fromLocal8Bit(cmd.c_str())));
1901
    return;
1901
    return;
1902
    }
1902
    }
1903
1903
1904
    // Look for the command to execute in the exec path and the filters 
1904
    // Look for the command to execute in the exec path and the filters 
...
...
1926
    }
1926
    }
1927
    }
1927
    }
1928
1928
1929
    // Command not found: start the user dialog to help find another one:
1929
    // Command not found: start the user dialog to help find another one:
1930
    if (execpath.empty()) {
1930
    if (execpath.empty()) {
1931
    QString mt = QString::fromAscii(doc.mimetype.c_str());
1931
    QString mt = QString::fromUtf8(doc.mimetype.c_str());
1932
    QString message = tr("The viewer specified in mimeview for %1: %2"
1932
    QString message = tr("The viewer specified in mimeview for %1: %2"
1933
                 " is not found.\nDo you want to start the "
1933
                 " is not found.\nDo you want to start the "
1934
                 " preferences dialog ?")
1934
                 " preferences dialog ?")
1935
        .arg(mt).arg(QString::fromLocal8Bit(lcmd.front().c_str()));
1935
        .arg(mt).arg(QString::fromLocal8Bit(lcmd.front().c_str()));
1936
1936
...
...
1967
1967
1968
    if (wantsfile && wantsparentfile) {
1968
    if (wantsfile && wantsparentfile) {
1969
    QMessageBox::warning(0, "Recoll", 
1969
    QMessageBox::warning(0, "Recoll", 
1970
                 tr("Viewer command line for %1 specifies both "
1970
                 tr("Viewer command line for %1 specifies both "
1971
                "file and parent file value: unsupported")
1971
                "file and parent file value: unsupported")
1972
                 .arg(QString::fromAscii(doc.mimetype.c_str())));
1972
                 .arg(QString::fromUtf8(doc.mimetype.c_str())));
1973
    return;
1973
    return;
1974
    }
1974
    }
1975
    
1975
    
1976
    string url = doc.url;
1976
    string url = doc.url;
1977
    string fn = fileurltolocalpath(doc.url);
1977
    string fn = fileurltolocalpath(doc.url);