diff --git a/src/qtgui/advsearch_w.cpp b/src/qtgui/advsearch_w.cpp index 047b5ec7..7b1e34c1 100644 --- a/src/qtgui/advsearch_w.cpp +++ b/src/qtgui/advsearch_w.cpp @@ -449,7 +449,7 @@ void AdvSearch::runSearch() } saveCnf(); g_advshistory && g_advshistory->push(sdata); - emit startSearch(sdata); + emit startSearch(sdata, false); } diff --git a/src/qtgui/advsearch_w.h b/src/qtgui/advsearch_w.h index 7c77e071..c988a337 100644 --- a/src/qtgui/advsearch_w.h +++ b/src/qtgui/advsearch_w.h @@ -67,7 +67,7 @@ public slots: virtual void slotHistoryPrev(); signals: - void startSearch(RefCntr); + void startSearch(RefCntr, bool); private: virtual void init(); diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 6e069590..fcfe62f8 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -40,8 +40,8 @@ RclConfig *theconfig; // introducing blank space. const char *PrefsPack::dfltResListFormat = "" - "
%S %L   %T
" - "%M %D   %U %i
" + "
%L  %S   %T
" + "%M %D    %U %i
" "%A %K
" ; diff --git a/src/qtgui/rclmain.ui b/src/qtgui/rclmain.ui index 1f4c1874..2bd58d0e 100644 --- a/src/qtgui/rclmain.ui +++ b/src/qtgui/rclmain.ui @@ -127,7 +127,7 @@ 0 0 800 - 23 + 21 @@ -177,8 +177,24 @@ + + + &Results + + + + + + + + + + + + + @@ -438,7 +454,7 @@ :/images/up.png:/images/up.png - sortByDateAsc + Sort by date, oldest first Sort by dates from oldest to newest @@ -456,7 +472,7 @@ :/images/down.png:/images/down.png - sortByDateDesc + Sort by date, newest first Sort by dates from newest to oldest @@ -476,10 +492,33 @@ :/images/table.png:/images/table.png - Show results as table + Show as table - Show results as table + Show results in a spreadsheet-like table + + + + + Save as CSV (spreadsheet) file + + + Saves the result into a file which you can load in a spreadsheet + + + + + Next Page + + + + + Previous Page + + + + + First Page diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 936d008b..a99f953a 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -228,8 +228,8 @@ void RclMain::init() connect(&m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(idxStatus())); - connect(sSearch, SIGNAL(startSearch(RefCntr)), - this, SLOT(startSearch(RefCntr))); + connect(sSearch, SIGNAL(startSearch(RefCntr, bool)), + this, SLOT(startSearch(RefCntr, bool))); connect(sSearch, SIGNAL(clearSearch()), this, SLOT(resetSearch())); @@ -281,6 +281,8 @@ void RclMain::init() this, SLOT(periodic100())); restable->setRclMain(this, true); + connect(actionSaveResultsAsCSV, SIGNAL(activated()), + restable, SLOT(saveAsCSV())); connect(this, SIGNAL(docSourceChanged(RefCntr)), restable, SLOT(setDocSource(RefCntr))); connect(this, SIGNAL(searchReset()), @@ -775,7 +777,7 @@ void RclMain::rebuildIndex() } // Start a db query and set the reslist docsource -void RclMain::startSearch(RefCntr sdata) +void RclMain::startSearch(RefCntr sdata, bool issimple) { LOGDEB(("RclMain::startSearch. Indexing %s Active %d\n", m_idxproc?"on":"off", m_queryActive)); @@ -786,6 +788,8 @@ void RclMain::startSearch(RefCntr sdata) m_queryActive = true; m_source = RefCntr(); + m_searchIsSimple = issimple; + // The db may have been closed at the end of indexing string reason; // If indexing is being performed, we reopen the db at each query. @@ -897,8 +901,9 @@ void RclMain::showAdvSearchDialog() connect(new QShortcut(quitKeySeq, asearchform), SIGNAL (activated()), this, SLOT (fileExit())); - connect(asearchform, SIGNAL(startSearch(RefCntr)), - this, SLOT(startSearch(RefCntr))); + connect(asearchform, + SIGNAL(startSearch(RefCntr, bool)), + this, SLOT(startSearch(RefCntr, bool))); asearchform->show(); } else { // Close and reopen, in hope that makes us visible... @@ -1464,15 +1469,15 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on) { LOGDEB(("RclMain::on_actionShowResultsAsTable_toggled(%d)\n", int(on))); prefs.showResultsAsTable = on; + displayingTable = on; restable->setVisible(on); reslist->setVisible(!on); + actionSaveResultsAsCSV->setEnabled(on); if (!on) { - displayingTable = false; int docnum = restable->getDetailDocNumOrTopRow(); if (docnum >= 0) reslist->resultPageFor(docnum); } else { - displayingTable = true; int docnum = reslist->pageFirstDocNum(); if (docnum >= 0) { restable->makeRowVisible(docnum); diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index e1408307..b353d2f8 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -72,7 +72,8 @@ public: m_sortspecnochange(false), m_indexerState(IXST_RUNNINGNOTMINE), m_queryActive(false), - m_firstIndexing(false) + m_firstIndexing(false), + m_searchIsSimple(false) { setupUi(this); init(); @@ -87,6 +88,11 @@ public: /** Same usage: actually display the current urltoview */ virtual void viewUrl(); + bool lastSearchSimple() + { + return m_searchIsSimple; + } + public slots: virtual bool close(); virtual void fileExit(); @@ -94,7 +100,7 @@ public slots: virtual void periodic100(); virtual void toggleIndexing(); virtual void rebuildIndex(); - virtual void startSearch(RefCntr sdata); + virtual void startSearch(RefCntr sdata, bool issimple); virtual void previewClosed(Preview *w); virtual void showAdvSearchDialog(); virtual void showSpellDialog(); @@ -180,6 +186,7 @@ private: IndexerState m_indexerState; bool m_queryActive; bool m_firstIndexing; + bool m_searchIsSimple; // Last search was started from simple // If set on init, will be displayed either through ext app, or // preview (if no ext app set) diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index fb5424dc..3f3c7d00 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -191,6 +191,9 @@ void QtGuiResListPager::suggest(const vectoruterms, return; } + bool issimple = m_reslist && m_reslist->m_rclmain && + m_reslist->m_rclmain->lastSearchSimple(); + for (vector::const_iterator uit = uterms.begin(); uit != uterms.end(); uit++) { list asuggs; @@ -217,8 +220,10 @@ void QtGuiResListPager::suggest(const vectoruterms, // Set up the links as a . for (vector::iterator it = sugg[*uit].begin(); it != sugg[*uit].end(); it++) { - *it = string("" + - *it + ""; + if (issimple) { + *it = string("" + + *it + ""; + } } } } diff --git a/src/qtgui/restable.cpp b/src/qtgui/restable.cpp index 76ba0d10..11b8bf41 100644 --- a/src/qtgui/restable.cpp +++ b/src/qtgui/restable.cpp @@ -675,6 +675,8 @@ void ResTable::saveAsCSV() tr("Save table to CSV file"), QString::fromLocal8Bit(path_home().c_str()) ); + if (s.isEmpty()) + return; const char *tofile = s.toLocal8Bit(); FILE *fp = fopen(tofile, "w"); if (fp == 0) { diff --git a/src/qtgui/ssearch_w.cpp b/src/qtgui/ssearch_w.cpp index d27a6fba..3f07fff2 100644 --- a/src/qtgui/ssearch_w.cpp +++ b/src/qtgui/ssearch_w.cpp @@ -266,7 +266,7 @@ bool SSearch::startSimpleSearch(const string& u8, int maxexp) sdata->setMaxExpand(maxexp); } RefCntr rsdata(sdata); - emit startSearch(rsdata); + emit startSearch(rsdata, true); return true; } diff --git a/src/qtgui/ssearch_w.h b/src/qtgui/ssearch_w.h index 7cefe8c8..e8b6e14f 100644 --- a/src/qtgui/ssearch_w.h +++ b/src/qtgui/ssearch_w.h @@ -59,7 +59,7 @@ public slots: virtual void wrapupCompletion(); virtual void timerDone(); signals: - void startSearch(RefCntr); + void startSearch(RefCntr, bool); void clearSearch(); private: bool m_escape;