optionally remember sorting state between invocations

This commit is contained in:
dockes 2007-05-24 07:48:19 +00:00
parent edada96bf8
commit 747a6183c2
5 changed files with 37 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.31 2007-02-14 10:10:43 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.32 2007-05-24 07:48:19 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -201,6 +201,10 @@ void rwSettings(bool writing)
"english");
SETTING_RW(prefs.useDesktopOpen,
"/Recoll/prefs/useDesktopOpen", Bool, false);
SETTING_RW(prefs.keepSort,
"/Recoll/prefs/keepSort", Bool, false);
SETTING_RW(prefs.sortActive,
"/Recoll/prefs/sortActive", Bool, false);
SETTING_RW(prefs.queryBuildAbstract,
"/Recoll/prefs/query/buildAbstract", Bool, true);
SETTING_RW(prefs.queryReplaceAbstract,

View File

@ -17,7 +17,7 @@
#ifndef _GUIUTILS_H_INCLUDED_
#define _GUIUTILS_H_INCLUDED_
/*
* @(#$Id: guiutils.h,v 1.20 2007-02-14 10:10:43 dockes Exp $ (C) 2005 Jean-Francois Dockes
* @(#$Id: guiutils.h,v 1.21 2007-05-24 07:48:19 dockes Exp $ (C) 2005 Jean-Francois Dockes
* jean-francois.dockes@wanadoo.fr
*
* This program is free software; you can redistribute it and/or modify
@ -76,6 +76,8 @@ class PrefsPack {
int ssearchTyp;
QString htmlBrowser;
bool useDesktopOpen; // typically xdg-open, instead of mimeview settings
bool keepSort; // remember sort status between invocations
bool sortActive; // Remembered sort state.
bool queryBuildAbstract;
bool queryReplaceAbstract;
bool startWithAdvSearchOpen;

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.4 2006-12-05 15:23:50 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.5 2007-05-24 07:48:19 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -48,6 +48,16 @@ void SortForm::init()
mcntSB->setValue(prefs.sortWidth);
unsigned int spec = (unsigned int)prefs.sortSpec;
// Restore active/inactive state only once from prefs, only if requested
fprintf(stderr, "sort_w init\n");
if (prefs.keepSort) {
sortCB->setChecked(prefs.sortActive);
} else {
sortCB->setChecked(false);
}
// Always start with sort disabled
// We use 4 bits per spec hi is direction, 3 low bits = sort field
unsigned int v, d;
@ -63,8 +73,6 @@ void SortForm::init()
fldCMB2->setCurrentItem(v < 3 ? v : 0);
descCB2->setChecked(d!=0?true:false);
// Always start with sort disabled
sortCB->setChecked(false);
// signals and slots connections
connect(applyPB, SIGNAL(clicked()), this, SLOT(apply()));
@ -94,6 +102,8 @@ void SortForm::setData()
fldCMB2->setEnabled(sortCB->isChecked());
descCB2->setEnabled(sortCB->isChecked());
prefs.sortActive = sortCB->isChecked();
if (!sortCB->isChecked()) {
spec.sortwidth = 0;
} else {

View File

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>523</width>
<height>530</height>
<width>0</width>
<height>0</height>
</rect>
</property>
<property name="caption">
@ -319,6 +319,17 @@
<bool>false</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>keepSortCB</cstring>
</property>
<property name="text">
<string>Remember sorting preference between invocations.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</vbox>
</widget>
</vbox>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.16 2007-02-14 10:10:43 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.17 2007-05-24 07:48:19 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -105,6 +105,7 @@ void UIPrefsDialog::setFromPrefs()
initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen);
initStartSortCB->setChecked(prefs.startWithSortToolOpen);
useDesktopOpenCB->setChecked(prefs.useDesktopOpen);
keepSortCB->setChecked(prefs.keepSort);
// Result list font family and size
reslistFontFamily = prefs.reslistfontfamily;
@ -193,6 +194,7 @@ void UIPrefsDialog::accept()
prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked();
prefs.startWithSortToolOpen = initStartSortCB->isChecked();
prefs.useDesktopOpen = useDesktopOpenCB->isChecked();
prefs.keepSort = keepSortCB->isChecked();
prefs.syntAbsLen = syntlenSB->value();
prefs.syntAbsCtx = syntctxSB->value();