|
a/src/qtgui/rclmain_w.cpp |
|
b/src/qtgui/rclmain_w.cpp |
|
... |
|
... |
552 |
viewUrl();
|
552 |
viewUrl();
|
553 |
}
|
553 |
}
|
554 |
|
554 |
|
555 |
void RclMain::setStemLang(QAction *id)
|
555 |
void RclMain::setStemLang(QAction *id)
|
556 |
{
|
556 |
{
|
557 |
LOGDEB("RclMain::setStemLang(" << (id) << ")\n" );
|
557 |
LOGDEB("RclMain::setStemLang(" << id << ")\n");
|
558 |
// Check that the menu entry is for a stemming language change
|
558 |
// Check that the menu entry is for a stemming language change
|
559 |
// (might also be "show prefs" etc.
|
559 |
// (might also be "show prefs" etc.
|
560 |
bool isLangId = false;
|
560 |
bool isLangId = false;
|
561 |
for (map<QString, QAction*>::const_iterator it = m_stemLangToId.begin();
|
561 |
for (map<QString, QAction*>::const_iterator it = m_stemLangToId.begin();
|
562 |
it != m_stemLangToId.end(); it++) {
|
562 |
it != m_stemLangToId.end(); it++) {
|
|
... |
|
... |
582 |
lang = "ALL";
|
582 |
lang = "ALL";
|
583 |
} else {
|
583 |
} else {
|
584 |
lang = id->text();
|
584 |
lang = id->text();
|
585 |
}
|
585 |
}
|
586 |
prefs.queryStemLang = lang;
|
586 |
prefs.queryStemLang = lang;
|
587 |
LOGDEB("RclMain::setStemLang(" << (id) << "): lang [" << ((const char *)prefs.queryStemLang.toUtf8()) << "]\n" );
|
587 |
LOGDEB("RclMain::setStemLang(" << id << "): lang [" <<
|
|
|
588 |
qs2utf8s(prefs.queryStemLang) << "]\n");
|
588 |
rwSettings(true);
|
589 |
rwSettings(true);
|
589 |
emit stemLangChanged(lang);
|
590 |
emit stemLangChanged(lang);
|
590 |
}
|
591 |
}
|
591 |
|
592 |
|
592 |
// Set the checked stemming language item before showing the prefs menu
|
593 |
// Set the checked stemming language item before showing the prefs menu
|
593 |
void RclMain::setStemLang(const QString& lang)
|
594 |
void RclMain::setStemLang(const QString& lang)
|
594 |
{
|
595 |
{
|
595 |
LOGDEB("RclMain::setStemLang(" << ((const char *)lang.toUtf8()) << ")\n" );
|
596 |
LOGDEB("RclMain::setStemLang(" << qs2utf8s(lang) << ")\n");
|
596 |
QAction *id;
|
597 |
QAction *id;
|
597 |
if (lang == "") {
|
598 |
if (lang == "") {
|
598 |
id = m_idNoStem;
|
599 |
id = m_idNoStem;
|
599 |
} else if (lang == "ALL") {
|
600 |
} else if (lang == "ALL") {
|
600 |
id = m_idAllStem;
|
601 |
id = m_idAllStem;
|
|
... |
|
... |
624 |
QSystemTrayIcon::Information, 1000);
|
625 |
QSystemTrayIcon::Information, 1000);
|
625 |
}
|
626 |
}
|
626 |
|
627 |
|
627 |
void RclMain::closeEvent(QCloseEvent *ev)
|
628 |
void RclMain::closeEvent(QCloseEvent *ev)
|
628 |
{
|
629 |
{
|
629 |
LOGDEB("RclMain::closeEvent\n" );
|
630 |
LOGDEB("RclMain::closeEvent\n");
|
630 |
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
631 |
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
631 |
hide();
|
632 |
hide();
|
632 |
ev->ignore();
|
633 |
ev->ignore();
|
633 |
} else {
|
634 |
} else {
|
634 |
fileExit();
|
635 |
fileExit();
|
635 |
}
|
636 |
}
|
636 |
}
|
637 |
}
|
637 |
|
638 |
|
638 |
void RclMain::fileExit()
|
639 |
void RclMain::fileExit()
|
639 |
{
|
640 |
{
|
640 |
LOGDEB("RclMain: fileExit\n" );
|
641 |
LOGDEB("RclMain: fileExit\n");
|
641 |
// Don't save geometry if we're currently fullscreened
|
642 |
// Don't save geometry if we're currently fullscreened
|
642 |
if (!isFullScreen()) {
|
643 |
if (!isFullScreen()) {
|
643 |
prefs.mainwidth = width();
|
644 |
prefs.mainwidth = width();
|
644 |
prefs.mainheight = height();
|
645 |
prefs.mainheight = height();
|
645 |
}
|
646 |
}
|
|
... |
|
... |
663 |
}
|
664 |
}
|
664 |
|
665 |
|
665 |
// Start a db query and set the reslist docsource
|
666 |
// Start a db query and set the reslist docsource
|
666 |
void RclMain::startSearch(std::shared_ptr<Rcl::SearchData> sdata, bool issimple)
|
667 |
void RclMain::startSearch(std::shared_ptr<Rcl::SearchData> sdata, bool issimple)
|
667 |
{
|
668 |
{
|
668 |
LOGDEB("RclMain::startSearch. Indexing " << (m_idxproc?"on":"off") << " Active " << (m_queryActive) << "\n" );
|
669 |
LOGDEB("RclMain::startSearch. Indexing " << (m_idxproc?"on":"off") <<
|
|
|
670 |
" Active " << m_queryActive << "\n");
|
669 |
if (m_queryActive) {
|
671 |
if (m_queryActive) {
|
670 |
LOGDEB("startSearch: already active\n" );
|
672 |
LOGDEB("startSearch: already active\n");
|
671 |
return;
|
673 |
return;
|
672 |
}
|
674 |
}
|
673 |
m_queryActive = true;
|
675 |
m_queryActive = true;
|
674 |
restable->setEnabled(false);
|
676 |
restable->setEnabled(false);
|
675 |
m_source = std::shared_ptr<DocSequence>();
|
677 |
m_source = std::shared_ptr<DocSequence>();
|
|
... |
|
... |
792 |
void RclMain::onSortCtlChanged()
|
794 |
void RclMain::onSortCtlChanged()
|
793 |
{
|
795 |
{
|
794 |
if (m_sortspecnochange)
|
796 |
if (m_sortspecnochange)
|
795 |
return;
|
797 |
return;
|
796 |
|
798 |
|
797 |
LOGDEB("RclMain::onSortCtlChanged()\n" );
|
799 |
LOGDEB("RclMain::onSortCtlChanged()\n");
|
798 |
m_sortspec.reset();
|
800 |
m_sortspec.reset();
|
799 |
if (actionSortByDateAsc->isChecked()) {
|
801 |
if (actionSortByDateAsc->isChecked()) {
|
800 |
m_sortspec.field = "mtime";
|
802 |
m_sortspec.field = "mtime";
|
801 |
m_sortspec.desc = false;
|
803 |
m_sortspec.desc = false;
|
802 |
prefs.sortActive = true;
|
804 |
prefs.sortActive = true;
|
|
... |
|
... |
818 |
initiateQuery();
|
820 |
initiateQuery();
|
819 |
}
|
821 |
}
|
820 |
|
822 |
|
821 |
void RclMain::onSortDataChanged(DocSeqSortSpec spec)
|
823 |
void RclMain::onSortDataChanged(DocSeqSortSpec spec)
|
822 |
{
|
824 |
{
|
823 |
LOGDEB("RclMain::onSortDataChanged\n" );
|
825 |
LOGDEB("RclMain::onSortDataChanged\n");
|
824 |
m_sortspecnochange = true;
|
826 |
m_sortspecnochange = true;
|
825 |
if (spec.field.compare("mtime")) {
|
827 |
if (spec.field.compare("mtime")) {
|
826 |
actionSortByDateDesc->setChecked(false);
|
828 |
actionSortByDateDesc->setChecked(false);
|
827 |
actionSortByDateAsc->setChecked(false);
|
829 |
actionSortByDateAsc->setChecked(false);
|
828 |
} else {
|
830 |
} else {
|
|
... |
|
... |
841 |
initiateQuery();
|
843 |
initiateQuery();
|
842 |
}
|
844 |
}
|
843 |
|
845 |
|
844 |
void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
846 |
void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
845 |
{
|
847 |
{
|
846 |
LOGDEB("RclMain::on_actionShowResultsAsTable_toggled(" << (int(on)) << ")\n" );
|
848 |
LOGDEB("RclMain::on_actionShowResultsAsTable_toggled(" << on << ")\n");
|
847 |
prefs.showResultsAsTable = on;
|
849 |
prefs.showResultsAsTable = on;
|
848 |
displayingTable = on;
|
850 |
displayingTable = on;
|
849 |
restable->setVisible(on);
|
851 |
restable->setVisible(on);
|
850 |
reslist->setVisible(!on);
|
852 |
reslist->setVisible(!on);
|
851 |
actionSaveResultsAsCSV->setEnabled(on);
|
853 |
actionSaveResultsAsCSV->setEnabled(on);
|
852 |
static QShortcut tablefocseq(QKeySequence("Ctrl+r"), this);
|
854 |
static QShortcut tablefocseq(QKeySequence("Ctrl+r"), this);
|
853 |
if (!on) {
|
855 |
if (!on) {
|
854 |
int docnum = restable->getDetailDocNumOrTopRow();
|
856 |
int docnum = restable->getDetailDocNumOrTopRow();
|
855 |
if (docnum >= 0)
|
857 |
if (docnum >= 0) {
|
856 |
reslist->resultPageFor(docnum);
|
858 |
reslist->resultPageFor(docnum);
|
|
|
859 |
}
|
857 |
disconnect(&tablefocseq, SIGNAL(activated()),
|
860 |
disconnect(&tablefocseq, SIGNAL(activated()),
|
858 |
restable, SLOT(takeFocus()));
|
861 |
restable, SLOT(takeFocus()));
|
859 |
sSearch->takeFocus();
|
862 |
sSearch->takeFocus();
|
860 |
} else {
|
863 |
} else {
|
861 |
int docnum = reslist->pageFirstDocNum();
|
864 |
int docnum = reslist->pageFirstDocNum();
|
|
... |
|
... |
870 |
}
|
873 |
}
|
871 |
}
|
874 |
}
|
872 |
|
875 |
|
873 |
void RclMain::on_actionSortByDateAsc_toggled(bool on)
|
876 |
void RclMain::on_actionSortByDateAsc_toggled(bool on)
|
874 |
{
|
877 |
{
|
875 |
LOGDEB("RclMain::on_actionSortByDateAsc_toggled(" << (int(on)) << ")\n" );
|
878 |
LOGDEB("RclMain::on_actionSortByDateAsc_toggled(" << on << ")\n");
|
876 |
if (on) {
|
879 |
if (on) {
|
877 |
if (actionSortByDateDesc->isChecked()) {
|
880 |
if (actionSortByDateDesc->isChecked()) {
|
878 |
actionSortByDateDesc->setChecked(false);
|
881 |
actionSortByDateDesc->setChecked(false);
|
879 |
// Let our buddy work.
|
882 |
// Let our buddy work.
|
880 |
return;
|
883 |
return;
|
|
... |
|
... |
883 |
onSortCtlChanged();
|
886 |
onSortCtlChanged();
|
884 |
}
|
887 |
}
|
885 |
|
888 |
|
886 |
void RclMain::on_actionSortByDateDesc_toggled(bool on)
|
889 |
void RclMain::on_actionSortByDateDesc_toggled(bool on)
|
887 |
{
|
890 |
{
|
888 |
LOGDEB("RclMain::on_actionSortByDateDesc_toggled(" << (int(on)) << ")\n" );
|
891 |
LOGDEB("RclMain::on_actionSortByDateDesc_toggled(" << on << ")\n");
|
889 |
if (on) {
|
892 |
if (on) {
|
890 |
if (actionSortByDateAsc->isChecked()) {
|
893 |
if (actionSortByDateAsc->isChecked()) {
|
891 |
actionSortByDateAsc->setChecked(false);
|
894 |
actionSortByDateAsc->setChecked(false);
|
892 |
// Let our buddy work.
|
895 |
// Let our buddy work.
|
893 |
return;
|
896 |
return;
|
|
... |
|
... |
913 |
}
|
916 |
}
|
914 |
}
|
917 |
}
|
915 |
|
918 |
|
916 |
void RclMain::showSubDocs(Rcl::Doc doc)
|
919 |
void RclMain::showSubDocs(Rcl::Doc doc)
|
917 |
{
|
920 |
{
|
918 |
LOGDEB("RclMain::showSubDocs\n" );
|
921 |
LOGDEB("RclMain::showSubDocs\n");
|
919 |
string reason;
|
922 |
string reason;
|
920 |
if (!maybeOpenDb(reason)) {
|
923 |
if (!maybeOpenDb(reason)) {
|
921 |
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
|
924 |
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
|
922 |
return;
|
925 |
return;
|
923 |
}
|
926 |
}
|
|
... |
|
... |
942 |
|
945 |
|
943 |
// Search for document 'like' the selected one. We ask rcldb/xapian to find
|
946 |
// Search for document 'like' the selected one. We ask rcldb/xapian to find
|
944 |
// significant terms, and add them to the simple search entry.
|
947 |
// significant terms, and add them to the simple search entry.
|
945 |
void RclMain::docExpand(Rcl::Doc doc)
|
948 |
void RclMain::docExpand(Rcl::Doc doc)
|
946 |
{
|
949 |
{
|
947 |
LOGDEB("RclMain::docExpand()\n" );
|
950 |
LOGDEB("RclMain::docExpand()\n");
|
948 |
if (!rcldb)
|
951 |
if (!rcldb)
|
949 |
return;
|
952 |
return;
|
950 |
list<string> terms;
|
953 |
list<string> terms;
|
951 |
|
954 |
|
952 |
terms = m_source->expand(doc);
|
955 |
terms = m_source->expand(doc);
|
953 |
if (terms.empty()) {
|
956 |
if (terms.empty()) {
|
954 |
LOGDEB("RclMain::docExpand: no terms\n" );
|
957 |
LOGDEB("RclMain::docExpand: no terms\n");
|
955 |
return;
|
958 |
return;
|
956 |
}
|
959 |
}
|
957 |
// Do we keep the original query. I think we'd better not.
|
960 |
// Do we keep the original query. I think we'd better not.
|
958 |
// rcldb->expand is set to keep the original query terms instead.
|
961 |
// rcldb->expand is set to keep the original query terms instead.
|
959 |
QString text;// = sSearch->queryText->currentText();
|
962 |
QString text;// = sSearch->queryText->currentText();
|
|
... |
|
... |
968 |
sSearch->startSimpleSearch();
|
971 |
sSearch->startSimpleSearch();
|
969 |
}
|
972 |
}
|
970 |
|
973 |
|
971 |
void RclMain::showDocHistory()
|
974 |
void RclMain::showDocHistory()
|
972 |
{
|
975 |
{
|
973 |
LOGDEB("RclMain::showDocHistory\n" );
|
976 |
LOGDEB("RclMain::showDocHistory\n");
|
974 |
emit searchReset();
|
977 |
emit searchReset();
|
975 |
m_source = std::shared_ptr<DocSequence>();
|
978 |
m_source = std::shared_ptr<DocSequence>();
|
976 |
curPreview = 0;
|
979 |
curPreview = 0;
|
977 |
|
980 |
|
978 |
string reason;
|
981 |
string reason;
|
|
... |
|
... |
1024 |
// Called when the uiprefs dialog is ok'd
|
1027 |
// Called when the uiprefs dialog is ok'd
|
1025 |
void RclMain::setUIPrefs()
|
1028 |
void RclMain::setUIPrefs()
|
1026 |
{
|
1029 |
{
|
1027 |
if (!uiprefs)
|
1030 |
if (!uiprefs)
|
1028 |
return;
|
1031 |
return;
|
1029 |
LOGDEB("Recollmain::setUIPrefs\n" );
|
1032 |
LOGDEB("Recollmain::setUIPrefs\n");
|
1030 |
reslist->setFont();
|
1033 |
reslist->setFont();
|
1031 |
sSearch->setPrefs();
|
1034 |
sSearch->setPrefs();
|
1032 |
enbSynAction->setDisabled(prefs.synFile.isEmpty());
|
1035 |
enbSynAction->setDisabled(prefs.synFile.isEmpty());
|
1033 |
enbSynAction->setChecked(prefs.synFileEnable);
|
1036 |
enbSynAction->setChecked(prefs.synFileEnable);
|
1034 |
}
|
1037 |
}
|
|
... |
|
... |
1062 |
}
|
1065 |
}
|
1063 |
|
1066 |
|
1064 |
// User pressed a filter button: set filter params in reslist
|
1067 |
// User pressed a filter button: set filter params in reslist
|
1065 |
void RclMain::catgFilter(int id)
|
1068 |
void RclMain::catgFilter(int id)
|
1066 |
{
|
1069 |
{
|
1067 |
LOGDEB("RclMain::catgFilter: id " << (id) << "\n" );
|
1070 |
LOGDEB("RclMain::catgFilter: id " << id << "\n");
|
1068 |
if (id < 0 || id >= int(m_catgbutvec.size()))
|
1071 |
if (id < 0 || id >= int(m_catgbutvec.size()))
|
1069 |
return;
|
1072 |
return;
|
1070 |
|
1073 |
|
1071 |
switch (prefs.filterCtlStyle) {
|
1074 |
switch (prefs.filterCtlStyle) {
|
1072 |
case PrefsPack::FCS_MN:
|
1075 |
case PrefsPack::FCS_MN:
|