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
This commit is contained in:
parent
21c6025ba7
commit
61348a7731
@ -97,8 +97,6 @@ void rwSettings(bool writing)
|
|||||||
SETTING_RW(prefs.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3);
|
SETTING_RW(prefs.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3);
|
||||||
SETTING_RW(prefs.startWithAdvSearchOpen,
|
SETTING_RW(prefs.startWithAdvSearchOpen,
|
||||||
"/Recoll/prefs/startWithAdvSearchOpen", Bool, false);
|
"/Recoll/prefs/startWithAdvSearchOpen", Bool, false);
|
||||||
SETTING_RW(prefs.startWithSortToolOpen,
|
|
||||||
"/Recoll/prefs/startWithSortToolOpen", Bool, false);
|
|
||||||
SETTING_RW(prefs.previewHtml,
|
SETTING_RW(prefs.previewHtml,
|
||||||
"/Recoll/prefs/previewHtml", Bool, true);
|
"/Recoll/prefs/previewHtml", Bool, true);
|
||||||
|
|
||||||
@ -160,6 +158,8 @@ void rwSettings(bool writing)
|
|||||||
"/Recoll/prefs/keepSort", Bool, false);
|
"/Recoll/prefs/keepSort", Bool, false);
|
||||||
SETTING_RW(prefs.sortActive,
|
SETTING_RW(prefs.sortActive,
|
||||||
"/Recoll/prefs/sortActive", Bool, false);
|
"/Recoll/prefs/sortActive", Bool, false);
|
||||||
|
SETTING_RW(prefs.sortDesc,
|
||||||
|
"/Recoll/prefs/query/sortDesc", Bool, 0);
|
||||||
SETTING_RW(prefs.queryBuildAbstract,
|
SETTING_RW(prefs.queryBuildAbstract,
|
||||||
"/Recoll/prefs/query/buildAbstract", Bool, true);
|
"/Recoll/prefs/query/buildAbstract", Bool, true);
|
||||||
SETTING_RW(prefs.queryReplaceAbstract,
|
SETTING_RW(prefs.queryReplaceAbstract,
|
||||||
@ -172,10 +172,6 @@ void rwSettings(bool writing)
|
|||||||
SETTING_RW(prefs.autoSuffsEnable,
|
SETTING_RW(prefs.autoSuffsEnable,
|
||||||
"/Recoll/prefs/query/autoSuffsEnable", Bool, false);
|
"/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",
|
SETTING_RW(prefs.termMatchType, "/Recoll/prefs/query/termMatchType",
|
||||||
Int, 0);
|
Int, 0);
|
||||||
SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion",
|
SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion",
|
||||||
|
|||||||
@ -78,12 +78,12 @@ class PrefsPack {
|
|||||||
int pvheight;
|
int pvheight;
|
||||||
int ssearchTyp;
|
int ssearchTyp;
|
||||||
bool useDesktopOpen; // typically xdg-open, instead of mimeview settings
|
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 sortActive; // Remembered sort state.
|
||||||
|
bool sortDesc; // ..
|
||||||
bool queryBuildAbstract;
|
bool queryBuildAbstract;
|
||||||
bool queryReplaceAbstract;
|
bool queryReplaceAbstract;
|
||||||
bool startWithAdvSearchOpen;
|
bool startWithAdvSearchOpen;
|
||||||
bool startWithSortToolOpen;
|
|
||||||
bool previewHtml;
|
bool previewHtml;
|
||||||
bool collapseDuplicates;
|
bool collapseDuplicates;
|
||||||
// Extra query indexes. This are stored in the history file, not qt prefs
|
// Extra query indexes. This are stored in the history file, not qt prefs
|
||||||
@ -108,14 +108,11 @@ class PrefsPack {
|
|||||||
int syntAbsLen;
|
int syntAbsLen;
|
||||||
int syntAbsCtx;
|
int syntAbsCtx;
|
||||||
|
|
||||||
// Sort specs (sort_w.cpp knows how to deal with the values
|
|
||||||
int sortDepth;
|
|
||||||
int sortSpec;
|
|
||||||
|
|
||||||
// Remembered term match mode
|
// Remembered term match mode
|
||||||
int termMatchType;
|
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;
|
int rclVersion;
|
||||||
|
|
||||||
// Advanced search window clause list state
|
// Advanced search window clause list state
|
||||||
@ -131,7 +128,6 @@ class PrefsPack {
|
|||||||
queryBuildAbstract(true),
|
queryBuildAbstract(true),
|
||||||
queryReplaceAbstract(false),
|
queryReplaceAbstract(false),
|
||||||
startWithAdvSearchOpen(false),
|
startWithAdvSearchOpen(false),
|
||||||
startWithSortToolOpen(false),
|
|
||||||
termMatchType(0),
|
termMatchType(0),
|
||||||
rclVersion(1009)
|
rclVersion(1009)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 391 B |
BIN
src/qtgui/images/down.png
Executable file
BIN
src/qtgui/images/down.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
src/qtgui/images/up.png
Executable file
BIN
src/qtgui/images/up.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@ -65,7 +65,6 @@ RclDynConf *g_dynconf;
|
|||||||
int recollNeedsExit;
|
int recollNeedsExit;
|
||||||
int startIndexingAfterConfig;
|
int startIndexingAfterConfig;
|
||||||
RclMain *mainWindow;
|
RclMain *mainWindow;
|
||||||
static string recollsharedir;
|
|
||||||
|
|
||||||
void startManual(const string& helpindex)
|
void startManual(const string& helpindex)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -84,7 +84,6 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="toolsAdvanced_SearchAction"/>
|
<addaction name="toolsAdvanced_SearchAction"/>
|
||||||
<addaction name="toolsSort_parametersAction"/>
|
|
||||||
<addaction name="toolsDoc_HistoryAction"/>
|
<addaction name="toolsDoc_HistoryAction"/>
|
||||||
<addaction name="toolsSpellAction"/>
|
<addaction name="toolsSpellAction"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -101,6 +100,9 @@
|
|||||||
<addaction name="firstPageAction"/>
|
<addaction name="firstPageAction"/>
|
||||||
<addaction name="prevPageAction"/>
|
<addaction name="prevPageAction"/>
|
||||||
<addaction name="nextPageAction"/>
|
<addaction name="nextPageAction"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionSortByDateAsc"/>
|
||||||
|
<addaction name="actionSortByDateDesc"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="MenuBar">
|
<widget class="QMenuBar" name="MenuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@ -130,7 +132,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<addaction name="toolsDoc_HistoryAction"/>
|
<addaction name="toolsDoc_HistoryAction"/>
|
||||||
<addaction name="toolsAdvanced_SearchAction"/>
|
<addaction name="toolsAdvanced_SearchAction"/>
|
||||||
<addaction name="toolsSort_parametersAction"/>
|
|
||||||
<addaction name="toolsSpellAction"/>
|
<addaction name="toolsSpellAction"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="preferencesMenu">
|
<widget class="QMenu" name="preferencesMenu">
|
||||||
@ -210,6 +211,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="toolsDoc_HistoryAction">
|
<action name="toolsDoc_HistoryAction">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/history.png</normaloff>:/images/history.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Document &History</string>
|
<string>Document &History</string>
|
||||||
</property>
|
</property>
|
||||||
@ -221,6 +226,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="toolsAdvanced_SearchAction">
|
<action name="toolsAdvanced_SearchAction">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/asearch.png</normaloff>:/images/asearch.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Advanced Search</string>
|
<string>&Advanced Search</string>
|
||||||
</property>
|
</property>
|
||||||
@ -243,6 +252,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="toolsSpellAction">
|
<action name="toolsSpellAction">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/spell.png</normaloff>:/images/spell.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Term &explorer</string>
|
<string>Term &explorer</string>
|
||||||
</property>
|
</property>
|
||||||
@ -257,6 +270,10 @@
|
|||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/nextpage.png</normaloff>:/images/nextpage.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="iconText">
|
<property name="iconText">
|
||||||
<string>Next page</string>
|
<string>Next page</string>
|
||||||
</property>
|
</property>
|
||||||
@ -274,6 +291,10 @@
|
|||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/firstpage.png</normaloff>:/images/firstpage.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="iconText">
|
<property name="iconText">
|
||||||
<string>First page</string>
|
<string>First page</string>
|
||||||
</property>
|
</property>
|
||||||
@ -291,6 +312,10 @@
|
|||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/prevpage.png</normaloff>:/images/prevpage.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="iconText">
|
<property name="iconText">
|
||||||
<string>Previous page</string>
|
<string>Previous page</string>
|
||||||
</property>
|
</property>
|
||||||
@ -345,6 +370,42 @@
|
|||||||
<cstring>toggleFullScreenAction</cstring>
|
<cstring>toggleFullScreenAction</cstring>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSortByDateAsc">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/up.png</normaloff>:/images/up.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>sortByDateAsc</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Sort by dates from oldest to newest</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionSortByDateDesc">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="recoll.qrc">
|
||||||
|
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>sortByDateDesc</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Sort by dates from newest to oldest</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="2" margin="2"/>
|
<layoutdefault spacing="2" margin="2"/>
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
@ -364,6 +425,8 @@
|
|||||||
<include location="local">ssearch_w.h</include>
|
<include location="local">ssearch_w.h</include>
|
||||||
<include location="local">reslist.h</include>
|
<include location="local">reslist.h</include>
|
||||||
</includes>
|
</includes>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="recoll.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -91,7 +91,6 @@ void RclMain::init()
|
|||||||
|
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
asearchform = 0;
|
asearchform = 0;
|
||||||
sortform = 0;
|
|
||||||
uiprefs = 0;
|
uiprefs = 0;
|
||||||
indexConfig = 0;
|
indexConfig = 0;
|
||||||
spellform = 0;
|
spellform = 0;
|
||||||
@ -247,8 +246,6 @@ void RclMain::init()
|
|||||||
this, SLOT(showDocHistory()));
|
this, SLOT(showDocHistory()));
|
||||||
connect(toolsAdvanced_SearchAction, SIGNAL(activated()),
|
connect(toolsAdvanced_SearchAction, SIGNAL(activated()),
|
||||||
this, SLOT(showAdvSearchDialog()));
|
this, SLOT(showAdvSearchDialog()));
|
||||||
connect(toolsSort_parametersAction, SIGNAL(activated()),
|
|
||||||
this, SLOT(showSortDialog()));
|
|
||||||
connect(toolsSpellAction, SIGNAL(activated()),
|
connect(toolsSpellAction, SIGNAL(activated()),
|
||||||
this, SLOT(showSpellDialog()));
|
this, SLOT(showSpellDialog()));
|
||||||
|
|
||||||
@ -264,23 +261,24 @@ void RclMain::init()
|
|||||||
// speeded up during indexing
|
// speeded up during indexing
|
||||||
periodictimer->start(1000);
|
periodictimer->start(1000);
|
||||||
|
|
||||||
toolsSpellAction->setIcon(QIcon(":/images/spell.png"));
|
connect(this, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
||||||
nextPageAction->setIcon(QIcon(":/images/nextpage.png"));
|
resList, SLOT(setSortParams(DocSeqSortSpec)));
|
||||||
prevPageAction->setIcon(QIcon(":/images/prevpage.png"));
|
connect(resList, SIGNAL(hasResults(int)), this, SLOT(resultCount(int)));
|
||||||
firstPageAction->setIcon(QIcon(":/images/firstpage.png"));
|
connect(this, SIGNAL(applySortData()), resList, SLOT(setDocSource()));
|
||||||
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.
|
|
||||||
if (prefs.keepSort && prefs.sortActive) {
|
if (prefs.keepSort && prefs.sortActive) {
|
||||||
SortForm sf(0);
|
if (prefs.sortDesc)
|
||||||
connect(&sf, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
actionSortByDateDesc->setChecked(true);
|
||||||
resList, SLOT(setSortParams(DocSeqSortSpec)));
|
else
|
||||||
// Have to call setdata again after sig connected...
|
actionSortByDateAsc->setChecked(true);
|
||||||
sf.setData();
|
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
|
// This is called by a timer right after we come up. Try to open
|
||||||
@ -318,8 +316,6 @@ void RclMain::initDbOpen()
|
|||||||
} else {
|
} else {
|
||||||
if (prefs.startWithAdvSearchOpen)
|
if (prefs.startWithAdvSearchOpen)
|
||||||
showAdvSearchDialog();
|
showAdvSearchDialog();
|
||||||
if (prefs.startWithSortToolOpen)
|
|
||||||
showSortDialog();
|
|
||||||
// If we have something in the search entry, it comes from a
|
// If we have something in the search entry, it comes from a
|
||||||
// command line argument
|
// command line argument
|
||||||
if (!nodb && sSearch->hasSearchString())
|
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()
|
void RclMain::showSpellDialog()
|
||||||
{
|
{
|
||||||
if (spellform == 0) {
|
if (spellform == 0) {
|
||||||
@ -824,6 +804,53 @@ void RclMain::previewExposed(Preview *, int sid, int docnum)
|
|||||||
resList->previewExposed(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
|
// Add term to simple search. Term comes out of double-click in
|
||||||
// reslist or preview.
|
// reslist or preview.
|
||||||
// It would probably be better to cleanup in preview.ui.h and
|
// It would probably be better to cleanup in preview.ui.h and
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
#include "preview_w.h"
|
#include "preview_w.h"
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "advsearch_w.h"
|
#include "advsearch_w.h"
|
||||||
#include "sort_w.h"
|
|
||||||
#include "uiprefs_w.h"
|
#include "uiprefs_w.h"
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
@ -64,7 +63,6 @@ public slots:
|
|||||||
virtual void startSearch(RefCntr<Rcl::SearchData> sdata);
|
virtual void startSearch(RefCntr<Rcl::SearchData> sdata);
|
||||||
virtual void previewClosed(Preview *w);
|
virtual void previewClosed(Preview *w);
|
||||||
virtual void showAdvSearchDialog();
|
virtual void showAdvSearchDialog();
|
||||||
virtual void showSortDialog();
|
|
||||||
virtual void showSpellDialog();
|
virtual void showSpellDialog();
|
||||||
virtual void showAboutDialog();
|
virtual void showAboutDialog();
|
||||||
virtual void showMissingHelpers();
|
virtual void showMissingHelpers();
|
||||||
@ -97,9 +95,14 @@ public slots:
|
|||||||
virtual void initDbOpen();
|
virtual void initDbOpen();
|
||||||
virtual void toggleFullScreen();
|
virtual void toggleFullScreen();
|
||||||
virtual void focusToSearch();
|
virtual void focusToSearch();
|
||||||
|
virtual void on_actionSortByDateAsc_toggled(bool on);
|
||||||
|
virtual void on_actionSortByDateDesc_toggled(bool on);
|
||||||
|
virtual void resultCount(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stemLangChanged(const QString& lang);
|
void stemLangChanged(const QString& lang);
|
||||||
|
void sortDataChanged(DocSeqSortSpec);
|
||||||
|
void applySortData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent( QCloseEvent * );
|
virtual void closeEvent( QCloseEvent * );
|
||||||
@ -107,7 +110,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
Preview *curPreview;
|
Preview *curPreview;
|
||||||
AdvSearch *asearchform;
|
AdvSearch *asearchform;
|
||||||
SortForm *sortform;
|
|
||||||
UIPrefsDialog *uiprefs;
|
UIPrefsDialog *uiprefs;
|
||||||
ConfIndexW *indexConfig;
|
ConfIndexW *indexConfig;
|
||||||
SpellW *spellform;
|
SpellW *spellform;
|
||||||
@ -125,6 +127,7 @@ private:
|
|||||||
virtual void previewPrevOrNextInTab(Preview *, int sid, int docnum,
|
virtual void previewPrevOrNextInTab(Preview *, int sid, int docnum,
|
||||||
bool next);
|
bool next);
|
||||||
virtual void setStemLang(const QString& lang);
|
virtual void setStemLang(const QString& lang);
|
||||||
|
virtual void onSortDataChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RCLMAIN_W_H
|
#endif // RCLMAIN_W_H
|
||||||
|
|||||||
@ -12,7 +12,6 @@ HEADERS += \
|
|||||||
../qtgui/rclmain_w.h \
|
../qtgui/rclmain_w.h \
|
||||||
../qtgui/reslist.h \
|
../qtgui/reslist.h \
|
||||||
../qtgui/searchclause_w.h \
|
../qtgui/searchclause_w.h \
|
||||||
../qtgui/sort_w.h \
|
|
||||||
../qtgui/spell_w.h \
|
../qtgui/spell_w.h \
|
||||||
../qtgui/ssearch_w.h \
|
../qtgui/ssearch_w.h \
|
||||||
../qtgui/uiprefs_w.h \
|
../qtgui/uiprefs_w.h \
|
||||||
@ -31,7 +30,6 @@ SOURCES += \
|
|||||||
../qtgui/rclmain_w.cpp \
|
../qtgui/rclmain_w.cpp \
|
||||||
../qtgui/reslist.cpp \
|
../qtgui/reslist.cpp \
|
||||||
../qtgui/searchclause_w.cpp \
|
../qtgui/searchclause_w.cpp \
|
||||||
../qtgui/sort_w.cpp \
|
|
||||||
../qtgui/spell_w.cpp \
|
../qtgui/spell_w.cpp \
|
||||||
../qtgui/ssearch_w.cpp \
|
../qtgui/ssearch_w.cpp \
|
||||||
../qtgui/uiprefs_w.cpp \
|
../qtgui/uiprefs_w.cpp \
|
||||||
@ -42,13 +40,11 @@ SOURCES += \
|
|||||||
FORMS = \
|
FORMS = \
|
||||||
advsearch.ui \
|
advsearch.ui \
|
||||||
rclmain.ui \
|
rclmain.ui \
|
||||||
sort.ui \
|
|
||||||
spell.ui \
|
spell.ui \
|
||||||
ssearchb.ui \
|
ssearchb.ui \
|
||||||
uiprefs.ui \
|
uiprefs.ui \
|
||||||
viewaction.ui \
|
viewaction.ui \
|
||||||
|
|
||||||
|
|
||||||
RESOURCES = recoll.qrc
|
RESOURCES = recoll.qrc
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
|
|||||||
@ -9,5 +9,7 @@
|
|||||||
<file>images/firstpage.png</file>
|
<file>images/firstpage.png</file>
|
||||||
<file>images/sortparms.png</file>
|
<file>images/sortparms.png</file>
|
||||||
<file>images/spell.png</file>
|
<file>images/spell.png</file>
|
||||||
|
<file>images/up.png</file>
|
||||||
|
<file>images/down.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -273,6 +273,7 @@ void ResList::setDocSource(RefCntr<DocSequence> ndocsource)
|
|||||||
// Reapply parameters. Sort params probably changed
|
// Reapply parameters. Sort params probably changed
|
||||||
void ResList::setDocSource()
|
void ResList::setDocSource()
|
||||||
{
|
{
|
||||||
|
LOGDEB(("ResList::setDocSource\n"));
|
||||||
if (m_baseDocSource.isNull())
|
if (m_baseDocSource.isNull())
|
||||||
return;
|
return;
|
||||||
resetList();
|
resetList();
|
||||||
@ -292,23 +293,29 @@ void ResList::setDocSource()
|
|||||||
title));
|
title));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_sortspecs.isNotNull()) {
|
if (m_docSource->canSort()) {
|
||||||
string title = m_baseDocSource->title() + " (" +
|
m_docSource->setSortSpec(m_sortspecs);
|
||||||
string((const char *)tr("sorted").toUtf8()) + ")";
|
} else {
|
||||||
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_docSource,
|
if (m_sortspecs.isNotNull()) {
|
||||||
m_sortspecs,
|
LOGDEB(("Reslist: sortspecs not Null\n"));
|
||||||
title));
|
string title = m_baseDocSource->title() + " (" +
|
||||||
|
string((const char *)tr("sorted").toUtf8()) + ")";
|
||||||
|
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_docSource,
|
||||||
|
m_sortspecs,
|
||||||
|
title));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Reset the page size in case the preference was changed
|
// Reset the page size in case the preference was changed
|
||||||
m_pager->setPageSize(prefs.respagesize);
|
m_pager->setPageSize(prefs.respagesize);
|
||||||
m_pager->setDocSource(m_docSource);
|
m_pager->setDocSource(m_docSource);
|
||||||
resultPageNext();
|
resultPageNext();
|
||||||
|
emit hasResults(getResCnt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResList::setSortParams(DocSeqSortSpec spec)
|
void ResList::setSortParams(DocSeqSortSpec spec)
|
||||||
{
|
{
|
||||||
LOGDEB(("ResList::setSortParams\n"));
|
LOGDEB(("ResList::setSortParams: %s\n", spec.isNotNull() ? "notnull":"null"));
|
||||||
m_sortspecs = spec;
|
m_sortspecs = spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,7 @@ class ResList : public QTextBrowser
|
|||||||
void docExpand(int);
|
void docExpand(int);
|
||||||
void wordSelect(QString);
|
void wordSelect(QString);
|
||||||
void linkClicked(const QString&, int); // See emitLinkClicked()
|
void linkClicked(const QString&, int); // See emitLinkClicked()
|
||||||
|
void hasResults(int);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
|
|||||||
@ -1,128 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0" stdsetdef="1">
|
|
||||||
<author></author>
|
|
||||||
<comment></comment>
|
|
||||||
<exportmacro></exportmacro>
|
|
||||||
<class>SortFormBase</class>
|
|
||||||
<widget class="QDialog" name="SortFormBase">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>200</width>
|
|
||||||
<height>100</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Sort Criteria</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="sortCB">
|
|
||||||
<property name="text">
|
|
||||||
<string>Sort the</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="mcntSB">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>10000</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="textLabel2">
|
|
||||||
<property name="text">
|
|
||||||
<string>most relevant results by:</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="fldCMB1">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="descCB1">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Descending</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="fldCMB2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="descCB2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Descending</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="applyPB">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Apply</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="closePB">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Close</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
|
||||||
</ui>
|
|
||||||
@ -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 <qcombobox.h>
|
|
||||||
#include <qspinbox.h>
|
|
||||||
#include <qcheckbox.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
}
|
|
||||||
@ -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 <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
#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_ */
|
|
||||||
@ -254,16 +254,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="initStartSortCB">
|
|
||||||
<property name="text">
|
|
||||||
<string>Start with sort dialog open.</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="keepSortCB">
|
<widget class="QCheckBox" name="keepSortCB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
@ -96,7 +96,6 @@ void UIPrefsDialog::setFromPrefs()
|
|||||||
syntctxSB->setValue(prefs.syntAbsCtx);
|
syntctxSB->setValue(prefs.syntAbsCtx);
|
||||||
|
|
||||||
initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen);
|
initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen);
|
||||||
initStartSortCB->setChecked(prefs.startWithSortToolOpen);
|
|
||||||
|
|
||||||
// External editor. Can use desktop prefs or internal
|
// External editor. Can use desktop prefs or internal
|
||||||
useDesktopOpenCB->setChecked(prefs.useDesktopOpen);
|
useDesktopOpenCB->setChecked(prefs.useDesktopOpen);
|
||||||
@ -204,7 +203,6 @@ void UIPrefsDialog::accept()
|
|||||||
replAbsCB->isChecked();
|
replAbsCB->isChecked();
|
||||||
|
|
||||||
prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked();
|
prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked();
|
||||||
prefs.startWithSortToolOpen = initStartSortCB->isChecked();
|
|
||||||
prefs.useDesktopOpen = useDesktopOpenCB->isChecked();
|
prefs.useDesktopOpen = useDesktopOpenCB->isChecked();
|
||||||
prefs.keepSort = keepSortCB->isChecked();
|
prefs.keepSort = keepSortCB->isChecked();
|
||||||
prefs.previewHtml = previewHtmlCB->isChecked();
|
prefs.previewHtml = previewHtmlCB->isChecked();
|
||||||
|
|||||||
@ -129,8 +129,23 @@ string DocSequenceDb::title()
|
|||||||
return m_filt ? DocSequence::title() + " (filtered)" : DocSequence::title();
|
return m_filt ? DocSequence::title() + " (filtered)" : DocSequence::title();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TBDone
|
|
||||||
bool DocSequenceDb::setSortSpec(DocSeqSortSpec &sortspec)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class DocSequenceDb : public DocSequence {
|
|||||||
virtual list<string> expand(Rcl::Doc &doc);
|
virtual list<string> expand(Rcl::Doc &doc);
|
||||||
virtual bool canFilter() {return true;}
|
virtual bool canFilter() {return true;}
|
||||||
virtual bool setFiltSpec(DocSeqFiltSpec &filtspec);
|
virtual bool setFiltSpec(DocSeqFiltSpec &filtspec);
|
||||||
virtual bool canSort() {return false;}
|
virtual bool canSort() {return true;}
|
||||||
virtual bool setSortSpec(DocSeqSortSpec &sortspec);
|
virtual bool setSortSpec(DocSeqSortSpec &sortspec);
|
||||||
virtual string title();
|
virtual string title();
|
||||||
virtual void setAbstractParams(bool qba, bool qra)
|
virtual void setAbstractParams(bool qba, bool qra)
|
||||||
|
|||||||
@ -105,6 +105,12 @@ static inline string make_parentterm(const string& udi)
|
|||||||
return pterm;
|
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
|
/* See comment in class declaration: return all subdocuments of a
|
||||||
* document given by its unique id.
|
* 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())
|
if (doc.meta.find(*it) == doc.meta.end())
|
||||||
parms.get(*it, doc.meta[*it]);
|
parms.get(*it, doc.meta[*it]);
|
||||||
}
|
}
|
||||||
|
doc.meta[Doc::keymt] = doc.dmtime.empty() ? doc.fmtime : doc.dmtime;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,12 +868,6 @@ void Db::setAbstractParams(int idxtrunc, int syntlen, int syntctxlen)
|
|||||||
m_synthAbsWordCtxLen = 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 int MB = 1024 * 1024;
|
||||||
static const string nc("\n\r\x0c");
|
static const string nc("\n\r\x0c");
|
||||||
|
|
||||||
|
|||||||
@ -27,18 +27,34 @@ namespace Rcl {
|
|||||||
// Sort helper class
|
// Sort helper class
|
||||||
class QSorter : public Xapian::Sorter {
|
class QSorter : public Xapian::Sorter {
|
||||||
public:
|
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();
|
string data = xdoc.get_data();
|
||||||
|
|
||||||
// It would be simpler to do the record->Rcl::Doc thing, but
|
// It would be simpler to do the record->Rcl::Doc thing, but
|
||||||
// hand-doing this will be faster. It makes more assumptions
|
// hand-doing this will be faster. It makes more assumptions
|
||||||
// about the format than a ConfTree though:
|
// about the format than a ConfTree though:
|
||||||
string::size_type i1, i2;
|
string::size_type i1, i2;
|
||||||
i1 = data.find(m_fld);
|
i1 = data.find(m_fld);
|
||||||
if (i1 == string::npos)
|
if (i1 == string::npos) {
|
||||||
return string();
|
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();
|
i1 += m_fld.length();
|
||||||
if (i1 >= data.length())
|
if (i1 >= data.length())
|
||||||
return string();
|
return string();
|
||||||
@ -50,6 +66,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
string m_fld;
|
string m_fld;
|
||||||
|
bool m_ismtime;
|
||||||
};
|
};
|
||||||
|
|
||||||
Query::Query(Db *db)
|
Query::Query(Db *db)
|
||||||
@ -78,8 +95,12 @@ Db *Query::whatDb()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Query::setSortBy(const string& fld, bool ascending) {
|
void Query::setSortBy(const string& fld, bool ascending) {
|
||||||
m_sortField = m_db->getConf()->fieldCanon(fld);
|
if (fld.empty()) {
|
||||||
m_sortAscending = ascending;
|
m_sortField.erase();
|
||||||
|
} else {
|
||||||
|
m_sortField = m_db->getConf()->fieldCanon(fld);
|
||||||
|
m_sortAscending = ascending;
|
||||||
|
}
|
||||||
LOGDEB0(("RclQuery::setSortBy: [%s] %s\n", m_sortField.c_str(),
|
LOGDEB0(("RclQuery::setSortBy: [%s] %s\n", m_sortField.c_str(),
|
||||||
m_sortAscending ? "ascending" : "descending"));
|
m_sortAscending ? "ascending" : "descending"));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user