GUI: "remember sort state" option would cause crash on startup

This commit is contained in:
Jean-Francois Dockes 2011-02-13 08:46:46 +01:00
parent 6a8b1d283f
commit 1c5fe35b7c

View File

@ -188,13 +188,6 @@ void RclMain::init()
sSearch->queryText->installEventFilter(this); sSearch->queryText->installEventFilter(this);
if (prefs.keepSort && prefs.sortActive) {
if (prefs.sortDesc)
actionSortByDateDesc->setChecked(true);
else
actionSortByDateAsc->setChecked(true);
onSortCtlChanged();
}
restable = new ResTable(this); restable = new ResTable(this);
verticalLayout->insertWidget(2, restable); verticalLayout->insertWidget(2, restable);
actionShowResultsAsTable->setChecked(prefs.showResultsAsTable); actionShowResultsAsTable->setChecked(prefs.showResultsAsTable);
@ -311,6 +304,14 @@ void RclMain::init()
connect(reslist, SIGNAL(headerClicked()), connect(reslist, SIGNAL(headerClicked()),
this, SLOT(showQueryDetails())); this, SLOT(showQueryDetails()));
if (prefs.keepSort && prefs.sortActive) {
if (prefs.sortDesc)
actionSortByDateDesc->setChecked(true);
else
actionSortByDateAsc->setChecked(true);
onSortCtlChanged();
}
// Start timer on a slow period (used for checking ^C). Will be // Start timer on a slow period (used for checking ^C). Will be
// speeded up during indexing // speeded up during indexing
periodictimer->start(1000); periodictimer->start(1000);
@ -870,7 +871,7 @@ void RclMain::onSortCtlChanged()
if (m_sortspecnochange) if (m_sortspecnochange)
return; return;
LOGDEB(("RclMain::onCtlDataChanged()\n")); LOGDEB(("RclMain::onSortCtlChanged()\n"));
m_sortspec.reset(); m_sortspec.reset();
if (actionSortByDateAsc->isChecked()) { if (actionSortByDateAsc->isChecked()) {
m_sortspec.field = "mtime"; m_sortspec.field = "mtime";
@ -886,7 +887,8 @@ void RclMain::onSortCtlChanged()
prefs.sortActive = prefs.sortDesc = false; prefs.sortActive = prefs.sortDesc = false;
} }
LOGDEB(("RclMain::onCtlDataChanged(): emitting change signals\n")); LOGDEB(("RclMain::onCtlDataChanged(): emitting change signals\n"));
m_source->setSortSpec(m_sortspec); if (m_source.isNotNull())
m_source->setSortSpec(m_sortspec);
emit sortDataChanged(m_sortspec); emit sortDataChanged(m_sortspec);
emit applyFiltSortData(); emit applyFiltSortData();
} }