From 61348a7731d44dda97980b5e47d26d61a2c2f5f5 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 17 Dec 2010 13:18:13 +0100 Subject: [PATCH] GUI: got rid of the sort parameters dialog and sort by mime type, replaced by 2 arrows in toolbar for sorting by date, ascending or descending --- src/qtgui/guiutils.cpp | 8 +- src/qtgui/guiutils.h | 12 +-- src/qtgui/images/d_firstpage.png | Bin 1271 -> 0 bytes src/qtgui/images/d_nextpage.png | Bin 1343 -> 0 bytes src/qtgui/images/d_prevpage.png | Bin 1331 -> 0 bytes src/qtgui/images/d_spell.png | Bin 391 -> 0 bytes src/qtgui/images/down.png | Bin 0 -> 3568 bytes src/qtgui/images/up.png | Bin 0 -> 3510 bytes src/qtgui/main.cpp | 1 - src/qtgui/rclmain.ui | 69 ++++++++++++++- src/qtgui/rclmain_w.cpp | 99 +++++++++++++-------- src/qtgui/rclmain_w.h | 9 +- src/qtgui/recoll.pro.in | 4 - src/qtgui/recoll.qrc | 2 + src/qtgui/reslist.cpp | 23 +++-- src/qtgui/reslist.h | 1 + src/qtgui/sort.ui | 128 ---------------------------- src/qtgui/sort_w.cpp | 142 ------------------------------- src/qtgui/sort_w.h | 53 ------------ src/qtgui/uiprefs.ui | 10 --- src/qtgui/uiprefs_w.cpp | 2 - src/query/docseqdb.cpp | 19 ++++- src/query/docseqdb.h | 2 +- src/rcldb/rcldb.cpp | 13 +-- src/rcldb/rclquery.cpp | 35 ++++++-- 25 files changed, 212 insertions(+), 420 deletions(-) delete mode 100644 src/qtgui/images/d_firstpage.png delete mode 100644 src/qtgui/images/d_nextpage.png delete mode 100644 src/qtgui/images/d_prevpage.png delete mode 100644 src/qtgui/images/d_spell.png create mode 100755 src/qtgui/images/down.png create mode 100755 src/qtgui/images/up.png delete mode 100644 src/qtgui/sort.ui delete mode 100644 src/qtgui/sort_w.cpp delete mode 100644 src/qtgui/sort_w.h diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index e424eb6a..07b8cba0 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -97,8 +97,6 @@ void rwSettings(bool writing) SETTING_RW(prefs.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3); SETTING_RW(prefs.startWithAdvSearchOpen, "/Recoll/prefs/startWithAdvSearchOpen", Bool, false); - SETTING_RW(prefs.startWithSortToolOpen, - "/Recoll/prefs/startWithSortToolOpen", Bool, false); SETTING_RW(prefs.previewHtml, "/Recoll/prefs/previewHtml", Bool, true); @@ -160,6 +158,8 @@ void rwSettings(bool writing) "/Recoll/prefs/keepSort", Bool, false); SETTING_RW(prefs.sortActive, "/Recoll/prefs/sortActive", Bool, false); + SETTING_RW(prefs.sortDesc, + "/Recoll/prefs/query/sortDesc", Bool, 0); SETTING_RW(prefs.queryBuildAbstract, "/Recoll/prefs/query/buildAbstract", Bool, true); SETTING_RW(prefs.queryReplaceAbstract, @@ -172,10 +172,6 @@ void rwSettings(bool writing) SETTING_RW(prefs.autoSuffsEnable, "/Recoll/prefs/query/autoSuffsEnable", Bool, false); - SETTING_RW(prefs.sortDepth, "/Recoll/prefs/query/sortDepth", - Int, 100); - SETTING_RW(prefs.sortSpec, "/Recoll/prefs/query/sortSpec", - Int, 0); SETTING_RW(prefs.termMatchType, "/Recoll/prefs/query/termMatchType", Int, 0); SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion", diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 15fb5642..f068cbc4 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -78,12 +78,12 @@ class PrefsPack { int pvheight; int ssearchTyp; bool useDesktopOpen; // typically xdg-open, instead of mimeview settings - bool keepSort; // remember sort status between invocations + bool keepSort; // Remember sort status between invocations bool sortActive; // Remembered sort state. + bool sortDesc; // .. bool queryBuildAbstract; bool queryReplaceAbstract; bool startWithAdvSearchOpen; - bool startWithSortToolOpen; bool previewHtml; bool collapseDuplicates; // Extra query indexes. This are stored in the history file, not qt prefs @@ -108,14 +108,11 @@ class PrefsPack { int syntAbsLen; int syntAbsCtx; - // Sort specs (sort_w.cpp knows how to deal with the values - int sortDepth; - int sortSpec; - // Remembered term match mode int termMatchType; - // Program version that wrote this + // Program version that wrote this. Not used for now, in prevision + // of the case where we might need an incompatible change int rclVersion; // Advanced search window clause list state @@ -131,7 +128,6 @@ class PrefsPack { queryBuildAbstract(true), queryReplaceAbstract(false), startWithAdvSearchOpen(false), - startWithSortToolOpen(false), termMatchType(0), rclVersion(1009) { diff --git a/src/qtgui/images/d_firstpage.png b/src/qtgui/images/d_firstpage.png deleted file mode 100644 index ec0dc01ef7d021eb2a8cd26703e8366859dc0cdd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1271 zcmVbs+Bx`@~%yiFm=MZVJV<&m9pe|k1hpPTobqoH& zYPFj0oLh0utpNq+96;op>l$MY>h-$*vt02P(9eLcopYN&)$_a}K$@mA=iEN<+*t!!=Xp%0Q~LcrhlhuDJRV0{>ql9Z zeRpth@TAdbq#p&>YPC;*dtn%UdH(!)Ha0dmd-f~~3kygo0dUSSo6R^nI-=cf^YZ0O zX0zD~t@XD@M@RoYg?oRf^!swT{KeI)SH<<~*Ew_M48HG^Wf^Ij^5n@AR##UMLQpD| zSX*0TVPS!Ozkeo4lIvj@w$|6ze`&Q^ZVtYA^JYB^!*8x!xgr2oS6Ao2G);N->=`>d zJ2ab3mX?;tvJB@Ol}d$tJ}-K`-g26z{$w(FaP8VP;{n{gd-pS?RJ~fQ<~BDsxqSID zqtS>YNifFHZnxRq-bM()#fuj?JUk>#Q;adBX-c6`AWc*H{r&}|)bl8cepYwx-0_`r zUl$66g>&c50T6~EaU5feq0{NGv$HeTVLToaMbUeLTWeWbTB1}cmE$=6%J=;r6|e$q zRw@-41OZzAKALeH)9dxv-rk;zHW&B<@B30pxsl7|stQ;WLR1Td z0>&8PI0m5C>%CX0bB^8J-47Q*2r88d`}_L@L4Xiq&GWpf0t!m0qUU);QA9qU2Y3$( zAf^1^?9{Z@JbwI`SFc{7l*$Vs%JMX5jA1&Rk|YWLuLVIsrBZpfJE?#uP19MDBsk|j z5axfe>2%88-X13_A3Ns~<(%sR`*9q9Dy76)3&6vN54myU2BlKzG=cl~?=u_@KMK#X z46QZR+5=-uR~lmufag&ZSt%t#{J!PG;gDvt$#gmeKqYWnx^Y<9Dibr5uWF9>RM}#kB?bdS)tu-Gnq{0F>5WI zPR9-ggWbtwa?cp^(;N(N>C&aQK@jX}tv8}5x{%N3DHe+;rBF(dWf}YX`%I@(lu~$} z$9OzuZ*PycZ{O~YMx**{HhT&jH5!d<4sNwtZhd|II0%AgTI<4iJiZV`Q6QxhVHo0h z9zqDLwG4+t-n@BZJDtvCI2_)eOeXhEpa+dc!+i7yxqbV#1d7Yc%bzQyzLHXI2qD&T zxm^C_4T-I_2Pf)3IJwgvF!<9S3EeZet002ovPDHLkV1l*rUo8Lt diff --git a/src/qtgui/images/d_nextpage.png b/src/qtgui/images/d_nextpage.png deleted file mode 100644 index 5de60770aa5f849e728f1e3d4ace143a5107373f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1343 zcmV-F1;F}=P)sauQIbZ%fK@~c3@Wz5)zXK)_@IS?)Q3J6 z`g9-qN7Nz|y?7rglv40PDupUuNWA`tN~(Pbxz2cWq7yR{Pv-oXbLQ+m+&Hxe)^6Bu zdwvTF_&CJZ4dn349F6%)MeACm@^Xb&o6bBC;WMpIn%d$w4gd|DmbUL(JEh?1?SFc`W zW@d(Fv-z!MS)aWsk^U+;2!d~m#p3Z}$Bwao|9*5`XL)&Y&VRe$-Me>hG)?on!-o%NjvP6H>$<#n@dBk3VHjfD zHlw4X^!E1BYPE1(mn2Du1UE=uvk1VC+*|TTdyLS(z6ha8LZ{NtEQ^baxUS2tUAyS-?`KV>u4|Gc`NO9|FgZDi=XoqH zE~04~sZ@$|I&HVx?SgLGwlEAsD5Y3gSwRRvu~KcQmLrb)m8HOJ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{zk67zSL|#d8xN2m()4)ecitwPD-#VXxPV>ADUf1a@|I zz&XeK{Cp_I*47rvpM$ z&-1`J4+E0PWI``@yIt6}4NcRaswz0=V2puM3Qf~snkE{J#*OROuYWi2@rq#>5JH3+ z>$(oZFtD-l`{TtJLq4AeV=Q#VpkuKZeBa0Z{ysS8--OAVnVBhjp7$nWYNf z6pcoQ(&==VHcBbF-7fa__R#P5!8wPbC{R@uu~-b8b5tr7Y;A2-Ip-g2Zf+j_ zTJg`mym#;3FLQHqH(RY%q19@Q0|+65)KN;&@ApxyRcc5U1K8Nl-L^76I+_2&)h;>C+O0Iy0Z pM+hMSA*4wN*}in?lKG-_zX9KbGmXWc?q&c0002ovPDHLkV1h$nYEu9J diff --git a/src/qtgui/images/d_spell.png b/src/qtgui/images/d_spell.png deleted file mode 100644 index 270a5b3316b0667f36692aa1d61b8faa20c96ce3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 391 zcmV;20eJq2P);(#zyoLqki|oe;&bQ@ow9W4XrSy;2C||c zcH@|v@Wn6aiC@&VEuK*hPpZv~RYY{5N3q9c8xTUk0`r?als%qpqy?r_TGJL&p#ao5 zmoif#Qqu}NwW_M3X2#0Q5E0aMoiZcuJwyZmh?&v%y=ltK=(_HrrL4W3&@|12SLu2& zMoP7`C)XCuF*Dzr7P5mb#vueGEGK1Jj1d56(c>A%Qe(>a7N&KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH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ub4Mt5u}Acv(H_}8d%>{o;@j?ni=KVy#!gkgX@h@R2`N{`RVp4$1+`9 z{`7Un1=#PGUy5hDxz1%|Swez?u*FBGW&ZQJ=VqzFQP8a5nM#@0-iNE7=}mO=9d#_E z4tbHnWB7XPcxfl&3+K*0y6_h}d-B7nPUQ@5+U;Jm&|QUOk8tAHtev^|_Ttc;=Xvx? zLVBBLq1aRkk=oFmr&g-{C%^$?5$R>#n;7=2uzg}D;epPq->c$php-6DqkvHm7j$Q> z$HT+0hOj^Z80q1f0fNHvE?`*&7BN5$xCRQ@eisc78ylH~@9_-kxZoJl#G(oY{be`5 z;(@Uo0Mo_OEnG(u)k>yRjN0MhB;%4SZ;Z>HYHZflGh8F_M(&LWduJ}b@nAO@TdZb? kq#|Mg`j>C|Z{_ye0Ipv%eOt+*TL1t607*qoM6N<$g4W2RoB#j- literal 0 HcmV?d00001 diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp index 1325bf91..f7c6b159 100644 --- a/src/qtgui/main.cpp +++ b/src/qtgui/main.cpp @@ -65,7 +65,6 @@ RclDynConf *g_dynconf; int recollNeedsExit; int startIndexingAfterConfig; RclMain *mainWindow; -static string recollsharedir; void startManual(const string& helpindex) { diff --git a/src/qtgui/rclmain.ui b/src/qtgui/rclmain.ui index dcda3168..eb4a98ee 100644 --- a/src/qtgui/rclmain.ui +++ b/src/qtgui/rclmain.ui @@ -84,7 +84,6 @@ false - @@ -101,6 +100,9 @@ + + + @@ -130,7 +132,6 @@ - @@ -210,6 +211,10 @@ + + + :/images/history.png:/images/history.png + Document &History @@ -221,6 +226,10 @@ + + + :/images/asearch.png:/images/asearch.png + &Advanced Search @@ -243,6 +252,10 @@ + + + :/images/spell.png:/images/spell.png + Term &explorer @@ -257,6 +270,10 @@ false + + + :/images/nextpage.png:/images/nextpage.png + Next page @@ -274,6 +291,10 @@ false + + + :/images/firstpage.png:/images/firstpage.png + First page @@ -291,6 +312,10 @@ false + + + :/images/prevpage.png:/images/prevpage.png + Previous page @@ -345,6 +370,42 @@ toggleFullScreenAction + + + true + + + false + + + + :/images/up.png:/images/up.png + + + sortByDateAsc + + + Sort by dates from oldest to newest + + + + + true + + + false + + + + :/images/down.png:/images/down.png + + + sortByDateDesc + + + Sort by dates from newest to oldest + + qPixmapFromMimeSource @@ -364,6 +425,8 @@ ssearch_w.h reslist.h - + + + diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 83037a75..dfc89c19 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -91,7 +91,6 @@ void RclMain::init() curPreview = 0; asearchform = 0; - sortform = 0; uiprefs = 0; indexConfig = 0; spellform = 0; @@ -247,8 +246,6 @@ void RclMain::init() this, SLOT(showDocHistory())); connect(toolsAdvanced_SearchAction, SIGNAL(activated()), this, SLOT(showAdvSearchDialog())); - connect(toolsSort_parametersAction, SIGNAL(activated()), - this, SLOT(showSortDialog())); connect(toolsSpellAction, SIGNAL(activated()), this, SLOT(showSpellDialog())); @@ -264,23 +261,24 @@ void RclMain::init() // speeded up during indexing periodictimer->start(1000); - toolsSpellAction->setIcon(QIcon(":/images/spell.png")); - nextPageAction->setIcon(QIcon(":/images/nextpage.png")); - prevPageAction->setIcon(QIcon(":/images/prevpage.png")); - firstPageAction->setIcon(QIcon(":/images/firstpage.png")); - toolsDoc_HistoryAction->setIcon(QIcon(":/images/history.png")); - toolsAdvanced_SearchAction->setIcon(QIcon(":/images/asearch.png")); - toolsSort_parametersAction->setIcon(QIcon(":/images/sortparms.png")); - - // If requested by prefs, restore sort state. The easiest way is to let - // a SortForm do it for us. + connect(this, SIGNAL(sortDataChanged(DocSeqSortSpec)), + resList, SLOT(setSortParams(DocSeqSortSpec))); + connect(resList, SIGNAL(hasResults(int)), this, SLOT(resultCount(int))); + connect(this, SIGNAL(applySortData()), resList, SLOT(setDocSource())); if (prefs.keepSort && prefs.sortActive) { - SortForm sf(0); - connect(&sf, SIGNAL(sortDataChanged(DocSeqSortSpec)), - resList, SLOT(setSortParams(DocSeqSortSpec))); - // Have to call setdata again after sig connected... - sf.setData(); + if (prefs.sortDesc) + actionSortByDateDesc->setChecked(true); + else + actionSortByDateAsc->setChecked(true); + onSortDataChanged(); } + +} + +void RclMain::resultCount(int n) +{ + actionSortByDateAsc->setEnabled(n>0); + actionSortByDateDesc->setEnabled(n>0); } // This is called by a timer right after we come up. Try to open @@ -318,8 +316,6 @@ void RclMain::initDbOpen() } else { if (prefs.startWithAdvSearchOpen) showAdvSearchDialog(); - if (prefs.startWithSortToolOpen) - showSortDialog(); // If we have something in the search entry, it comes from a // command line argument if (!nodb && sSearch->hasSearchString()) @@ -590,22 +586,6 @@ void RclMain::showAdvSearchDialog() } } -void RclMain::showSortDialog() -{ - if (sortform == 0) { - sortform = new SortForm(0); - connect(sortform, SIGNAL(sortDataChanged(DocSeqSortSpec)), - resList, SLOT(setSortParams(DocSeqSortSpec))); - connect(sortform, SIGNAL(applySortData()), - resList, SLOT(setDocSource())); - sortform->show(); - } else { - // Close and reopen, in hope that makes us visible... - sortform->close(); - sortform->show(); - } -} - void RclMain::showSpellDialog() { if (spellform == 0) { @@ -824,6 +804,53 @@ void RclMain::previewExposed(Preview *, int sid, int docnum) resList->previewExposed(docnum); } +void RclMain::onSortDataChanged() +{ + LOGDEB(("RclMain::onSortDataChanged()\n")); + DocSeqSortSpec spec; + if (actionSortByDateAsc->isChecked()) { + spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, false); + spec.sortdepth = 1000000; + prefs.sortActive = true; + prefs.sortDesc = false; + } else if (actionSortByDateDesc->isChecked()) { + spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, true); + spec.sortdepth = 1000000; + prefs.sortActive = true; + prefs.sortDesc = true; + } else { + prefs.sortActive = prefs.sortDesc = false; + } + emit sortDataChanged(spec); + emit applySortData(); +} + +void RclMain::on_actionSortByDateAsc_toggled(bool on) +{ + LOGDEB(("RclMain::on_actionSortByDateAsc_toggled(%d)\n", int(on))); + if (on) { + if (actionSortByDateDesc->isChecked()) { + actionSortByDateDesc->setChecked(false); + // Let our buddy work. + return; + } + } + onSortDataChanged(); +} + +void RclMain::on_actionSortByDateDesc_toggled(bool on) +{ + LOGDEB(("RclMain::on_actionSortByDateDesc_toggled(%d)\n", int(on))); + if (on) { + if (actionSortByDateAsc->isChecked()) { + actionSortByDateAsc->setChecked(false); + // Let our buddy work. + return; + } + } + onSortDataChanged(); +} + // Add term to simple search. Term comes out of double-click in // reslist or preview. // It would probably be better to cleanup in preview.ui.h and diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index 4fdd4291..b6e2ad24 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -23,7 +23,6 @@ #include "preview_w.h" #include "recoll.h" #include "advsearch_w.h" -#include "sort_w.h" #include "uiprefs_w.h" #include "rcldb.h" #include "searchdata.h" @@ -64,7 +63,6 @@ public slots: virtual void startSearch(RefCntr sdata); virtual void previewClosed(Preview *w); virtual void showAdvSearchDialog(); - virtual void showSortDialog(); virtual void showSpellDialog(); virtual void showAboutDialog(); virtual void showMissingHelpers(); @@ -97,9 +95,14 @@ public slots: virtual void initDbOpen(); virtual void toggleFullScreen(); virtual void focusToSearch(); + virtual void on_actionSortByDateAsc_toggled(bool on); + virtual void on_actionSortByDateDesc_toggled(bool on); + virtual void resultCount(int); signals: void stemLangChanged(const QString& lang); + void sortDataChanged(DocSeqSortSpec); + void applySortData(); protected: virtual void closeEvent( QCloseEvent * ); @@ -107,7 +110,6 @@ protected: private: Preview *curPreview; AdvSearch *asearchform; - SortForm *sortform; UIPrefsDialog *uiprefs; ConfIndexW *indexConfig; SpellW *spellform; @@ -125,6 +127,7 @@ private: virtual void previewPrevOrNextInTab(Preview *, int sid, int docnum, bool next); virtual void setStemLang(const QString& lang); + virtual void onSortDataChanged(); }; #endif // RCLMAIN_W_H diff --git a/src/qtgui/recoll.pro.in b/src/qtgui/recoll.pro.in index eebeaff1..ae889862 100644 --- a/src/qtgui/recoll.pro.in +++ b/src/qtgui/recoll.pro.in @@ -12,7 +12,6 @@ HEADERS += \ ../qtgui/rclmain_w.h \ ../qtgui/reslist.h \ ../qtgui/searchclause_w.h \ - ../qtgui/sort_w.h \ ../qtgui/spell_w.h \ ../qtgui/ssearch_w.h \ ../qtgui/uiprefs_w.h \ @@ -31,7 +30,6 @@ SOURCES += \ ../qtgui/rclmain_w.cpp \ ../qtgui/reslist.cpp \ ../qtgui/searchclause_w.cpp \ - ../qtgui/sort_w.cpp \ ../qtgui/spell_w.cpp \ ../qtgui/ssearch_w.cpp \ ../qtgui/uiprefs_w.cpp \ @@ -42,13 +40,11 @@ SOURCES += \ FORMS = \ advsearch.ui \ rclmain.ui \ - sort.ui \ spell.ui \ ssearchb.ui \ uiprefs.ui \ viewaction.ui \ - RESOURCES = recoll.qrc unix { diff --git a/src/qtgui/recoll.qrc b/src/qtgui/recoll.qrc index 8d96d494..0b92ae56 100644 --- a/src/qtgui/recoll.qrc +++ b/src/qtgui/recoll.qrc @@ -9,5 +9,7 @@ images/firstpage.png images/sortparms.png images/spell.png + images/up.png + images/down.png diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 9384e43a..9b130344 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -273,6 +273,7 @@ void ResList::setDocSource(RefCntr ndocsource) // Reapply parameters. Sort params probably changed void ResList::setDocSource() { + LOGDEB(("ResList::setDocSource\n")); if (m_baseDocSource.isNull()) return; resetList(); @@ -292,23 +293,29 @@ void ResList::setDocSource() title)); } } - - if (m_sortspecs.isNotNull()) { - string title = m_baseDocSource->title() + " (" + - string((const char *)tr("sorted").toUtf8()) + ")"; - m_docSource = RefCntr(new DocSeqSorted(m_docSource, - m_sortspecs, - title)); + + if (m_docSource->canSort()) { + m_docSource->setSortSpec(m_sortspecs); + } else { + if (m_sortspecs.isNotNull()) { + LOGDEB(("Reslist: sortspecs not Null\n")); + string title = m_baseDocSource->title() + " (" + + string((const char *)tr("sorted").toUtf8()) + ")"; + m_docSource = RefCntr(new DocSeqSorted(m_docSource, + m_sortspecs, + title)); + } } // Reset the page size in case the preference was changed m_pager->setPageSize(prefs.respagesize); m_pager->setDocSource(m_docSource); resultPageNext(); + emit hasResults(getResCnt()); } void ResList::setSortParams(DocSeqSortSpec spec) { - LOGDEB(("ResList::setSortParams\n")); + LOGDEB(("ResList::setSortParams: %s\n", spec.isNotNull() ? "notnull":"null")); m_sortspecs = spec; } diff --git a/src/qtgui/reslist.h b/src/qtgui/reslist.h index 7f6f84a9..af025513 100644 --- a/src/qtgui/reslist.h +++ b/src/qtgui/reslist.h @@ -91,6 +91,7 @@ class ResList : public QTextBrowser void docExpand(int); void wordSelect(QString); void linkClicked(const QString&, int); // See emitLinkClicked() + void hasResults(int); protected: void keyPressEvent(QKeyEvent *e); diff --git a/src/qtgui/sort.ui b/src/qtgui/sort.ui deleted file mode 100644 index 179c3e3b..00000000 --- a/src/qtgui/sort.ui +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - SortFormBase - - - - 0 - 0 - 200 - 100 - - - - Sort Criteria - - - - - - - - - - Sort the - - - - - - - false - - - 10000 - - - 100 - - - - - - - most relevant results by: - - - false - - - - - - - - - - - false - - - - - - - false - - - Descending - - - - - - - - - - - false - - - - - - - false - - - Descending - - - - - - - - - - - true - - - Apply - - - - - - - true - - - Close - - - - - - - - - - - qPixmapFromMimeSource - diff --git a/src/qtgui/sort_w.cpp b/src/qtgui/sort_w.cpp deleted file mode 100644 index d4e71d58..00000000 --- a/src/qtgui/sort_w.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef lint -static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.7 2008-09-28 14:20:50 dockes Exp $ (C) 2006 J.F.Dockes"; -#endif -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include - -#include "sortseq.h" -#include "debuglog.h" -#include "guiutils.h" -#include "rclhelp.h" -#include "sort_w.h" - -void SortForm::init() -{ - QStringList slabs; - slabs += QString(); - slabs += tr("Date"); - slabs += tr("Mime type"); - - fldCMB1->addItems(slabs); - fldCMB2->addItems(slabs); - - // Initialize values from prefs: - mcntSB->setValue(prefs.sortDepth); - unsigned int spec = (unsigned int)prefs.sortSpec; - - // Restore active/inactive state from prefs, only if requested - if (prefs.keepSort) { - sortCB->setChecked(prefs.sortActive); - } else { - sortCB->setChecked(false); - } - - // We use 4 bits per spec hi is direction, 3 low bits = sort field - unsigned int v, d; - - v = spec & (0xf & ~(1<<3)); - d = spec & (1 << 3); - spec >>= 4; - fldCMB1->setCurrentIndex(v < 3 ? v : 0); - descCB1->setChecked(d != 0 ? true : false); - - v = spec & (0xf & ~(1<<3)); - d = spec & (1 << 3); - spec >>= 4; - fldCMB2->setCurrentIndex(v < 3 ? v : 0); - descCB2->setChecked(d !=0 ? true : false); - - (void)new HelpClient(this); - HelpClient::installMap((const char *)this->objectName().toUtf8(), - "RCL.SEARCH.SORT"); - - // signals and slots connections - connect(applyPB, SIGNAL(clicked()), this, SLOT(apply())); - connect(closePB, SIGNAL(clicked()), this, SLOT(close())); - connect(mcntSB, SIGNAL(valueChanged(int)), this, SLOT(setData())); - connect(fldCMB1, SIGNAL(activated(const QString&)), this, SLOT(setData())); - connect(fldCMB2, SIGNAL(activated(const QString&)), this, SLOT(setData())); - connect(descCB1, SIGNAL(stateChanged(int)), this, SLOT(setData())); - connect(descCB2, SIGNAL(stateChanged(int)), this, SLOT(setData())); - connect(sortCB, SIGNAL(toggled(bool)), this, SLOT(setData())); - - // Finalize state - setData(); -} - -// This is called when the 'apply' button is pressed. We -void SortForm::apply() -{ - setData(); - emit applySortData(); -} - -void SortForm::setData() -{ - LOGDEB(("SortForm::setData\n")); - DocSeqSortSpec spec; - - mcntSB->setEnabled(sortCB->isChecked()); - fldCMB1->setEnabled(sortCB->isChecked()); - descCB1->setEnabled(sortCB->isChecked()); - fldCMB2->setEnabled(sortCB->isChecked()); - descCB2->setEnabled(sortCB->isChecked()); - - prefs.sortActive = sortCB->isChecked(); - - if (!sortCB->isChecked()) { - spec.sortdepth = 0; - } else { - bool desc = descCB1->isChecked(); - switch (fldCMB1->currentIndex()) { - case 1: - spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, desc?true:false); - break; - case 2: - spec.addCrit(DocSeqSortSpec::RCLFLD_MIMETYPE, desc?true:false); - break; - } - - desc = descCB2->isChecked(); - switch (fldCMB2->currentIndex()) { - case 1: - spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, desc?true:false); - break; - case 2: - spec.addCrit(DocSeqSortSpec::RCLFLD_MIMETYPE, desc?true:false); - break; - } - spec.sortdepth = mcntSB->value(); - - // Save data to prefs; - prefs.sortDepth = spec.sortdepth; - unsigned int spec = 0, v, d; - v = fldCMB1->currentIndex() & 0x7; - d = descCB1->isChecked() ? 8 : 0; - spec |= (d|v); - v = fldCMB2->currentIndex() & 0x7; - d = descCB2->isChecked() ? 8 : 0; - spec |= (d|v) << 4; - prefs.sortSpec = (int) spec; - } - emit sortDataChanged(spec); -} diff --git a/src/qtgui/sort_w.h b/src/qtgui/sort_w.h deleted file mode 100644 index 88dd9c57..00000000 --- a/src/qtgui/sort_w.h +++ /dev/null @@ -1,53 +0,0 @@ -/* @(#$Id: sort_w.h,v 1.5 2006-12-05 15:23:50 dockes Exp $ (C) 2005 J.F.Dockes */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#ifndef _SORT_W_H_INCLUDED_ -#define _SORT_W_H_INCLUDED_ - -#include -#include -#include "sortseq.h" -#include "ui_sort.h" - -class QDialog; - -class SortForm : public QDialog, public Ui::SortFormBase -{ - Q_OBJECT - -public: - SortForm(QWidget* parent = 0) - : QDialog(parent) - { - setupUi(this); - init(); - } - ~SortForm() {} - -public slots: - virtual void apply(); - virtual void setData(); - -signals: - void sortDataChanged(DocSeqSortSpec); - void applySortData(); -private: - virtual void init(); -}; - - -#endif /* _SORT_W_H_INCLUDED_ */ diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 703da789..69106d33 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -254,16 +254,6 @@ - - - - Start with sort dialog open. - - - false - - - diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 4ca2154d..6fa09ace 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -96,7 +96,6 @@ void UIPrefsDialog::setFromPrefs() syntctxSB->setValue(prefs.syntAbsCtx); initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen); - initStartSortCB->setChecked(prefs.startWithSortToolOpen); // External editor. Can use desktop prefs or internal useDesktopOpenCB->setChecked(prefs.useDesktopOpen); @@ -204,7 +203,6 @@ void UIPrefsDialog::accept() replAbsCB->isChecked(); prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked(); - prefs.startWithSortToolOpen = initStartSortCB->isChecked(); prefs.useDesktopOpen = useDesktopOpenCB->isChecked(); prefs.keepSort = keepSortCB->isChecked(); prefs.previewHtml = previewHtmlCB->isChecked(); diff --git a/src/query/docseqdb.cpp b/src/query/docseqdb.cpp index 255b5d57..b6c78479 100644 --- a/src/query/docseqdb.cpp +++ b/src/query/docseqdb.cpp @@ -129,8 +129,23 @@ string DocSequenceDb::title() return m_filt ? DocSequence::title() + " (filtered)" : DocSequence::title(); } -// TBDone bool DocSequenceDb::setSortSpec(DocSeqSortSpec &sortspec) { - return true; + if (sortspec.isNotNull()) { + bool ascending = false; + for (unsigned int i = 0; i < sortspec.crits.size(); i++) { + switch (sortspec.crits[i]) { + case DocSeqSortSpec::RCLFLD_MTIME: + ascending = !sortspec.dirs[i]; + break; + default: + break; + } + } + m_q->setSortBy("mtime", ascending); + } else { + m_q->setSortBy(string(), true); + } + return m_q->setQuery(m_fsdata); } + diff --git a/src/query/docseqdb.h b/src/query/docseqdb.h index bba1628e..d7846a0f 100644 --- a/src/query/docseqdb.h +++ b/src/query/docseqdb.h @@ -42,7 +42,7 @@ class DocSequenceDb : public DocSequence { virtual list expand(Rcl::Doc &doc); virtual bool canFilter() {return true;} virtual bool setFiltSpec(DocSeqFiltSpec &filtspec); - virtual bool canSort() {return false;} + virtual bool canSort() {return true;} virtual bool setSortSpec(DocSeqSortSpec &sortspec); virtual string title(); virtual void setAbstractParams(bool qba, bool qra) diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 9edaf782..29141732 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -105,6 +105,12 @@ static inline string make_parentterm(const string& udi) return pterm; } +static inline void leftzeropad(string& s, unsigned len) +{ + if (s.length() && s.length() < len) + s = s.insert(0, len - s.length(), '0'); +} + /* See comment in class declaration: return all subdocuments of a * document given by its unique id. */ @@ -172,6 +178,7 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data, if (doc.meta.find(*it) == doc.meta.end()) parms.get(*it, doc.meta[*it]); } + doc.meta[Doc::keymt] = doc.dmtime.empty() ? doc.fmtime : doc.dmtime; return true; } @@ -861,12 +868,6 @@ void Db::setAbstractParams(int idxtrunc, int syntlen, int syntctxlen) m_synthAbsWordCtxLen = syntctxlen; } -static inline void leftzeropad(string& s, unsigned len) -{ - if (s.length() && s.length() < len) - s = s.insert(0, len-s.length(), '0'); -} - static const int MB = 1024 * 1024; static const string nc("\n\r\x0c"); diff --git a/src/rcldb/rclquery.cpp b/src/rcldb/rclquery.cpp index 3d4edd01..b5a84a76 100644 --- a/src/rcldb/rclquery.cpp +++ b/src/rcldb/rclquery.cpp @@ -27,18 +27,34 @@ namespace Rcl { // Sort helper class class QSorter : public Xapian::Sorter { public: - QSorter(const string& f) : m_fld(docfToDatf(f) + "=") {} + QSorter(const string& f) + : m_fld(docfToDatf(f) + "=") + { + m_ismtime = !m_fld.compare("mtime="); + if (m_ismtime) { + m_fld = "dmtime="; + } + } - virtual std::string operator()(const Xapian::Document& xdoc) const { + virtual std::string operator()(const Xapian::Document& xdoc) const + { string data = xdoc.get_data(); - // It would be simpler to do the record->Rcl::Doc thing, but // hand-doing this will be faster. It makes more assumptions // about the format than a ConfTree though: string::size_type i1, i2; i1 = data.find(m_fld); - if (i1 == string::npos) - return string(); + if (i1 == string::npos) { + if (m_ismtime) { + // Ugly: specialcase mtime as it's either dmtime or fmtime + i1 = data.find("fmtime="); + if (i1 == string::npos) { + return string(); + } + } else { + return string(); + } + } i1 += m_fld.length(); if (i1 >= data.length()) return string(); @@ -50,6 +66,7 @@ public: private: string m_fld; + bool m_ismtime; }; Query::Query(Db *db) @@ -78,8 +95,12 @@ Db *Query::whatDb() } void Query::setSortBy(const string& fld, bool ascending) { - m_sortField = m_db->getConf()->fieldCanon(fld); - m_sortAscending = ascending; + if (fld.empty()) { + m_sortField.erase(); + } else { + m_sortField = m_db->getConf()->fieldCanon(fld); + m_sortAscending = ascending; + } LOGDEB0(("RclQuery::setSortBy: [%s] %s\n", m_sortField.c_str(), m_sortAscending ? "ascending" : "descending")); }