Commit f0d193e5 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Reopen db before showing indexed MIME types, explain empty list

parent 5c46dbf7
......@@ -346,9 +346,11 @@ void RclMain::showMissingHelpers()
void RclMain::showActiveTypes()
{
if (rcldb == 0) {
string reason;
bool maindberror;
if (!maybeOpenDb(reason, true, &maindberror)) {
QMessageBox::warning(0, tr("Error"),
tr("Index not open"),
u8s2qs(reason),
QMessageBox::Ok,
QMessageBox::NoButton);
return;
......@@ -407,9 +409,14 @@ void RclMain::showActiveTypes()
editor->setReadOnly(true);
dialog.horizontalLayout->addWidget(editor);
for (set<string>::const_iterator it = mtypesfromdbconf.begin();
it != mtypesfromdbconf.end(); it++) {
editor->append(QString::fromUtf8(it->c_str()));
if (mtypesfromdbconf.empty()) {
editor->append(tr("Types list empty: maybe wait for indexing to "
"progress?"));
} else {
for (set<string>::const_iterator it = mtypesfromdbconf.begin();
it != mtypesfromdbconf.end(); it++) {
editor->append(QString::fromUtf8(it->c_str()));
}
}
editor->moveCursor(QTextCursor::Start);
editor->ensureCursorVisible();
......
......@@ -55,6 +55,10 @@ inline std::string qs2utf8s(const QString& qs)
{
return std::string((const char *)qs.toUtf8());
}
inline QString u8s2qs(const std::string us)
{
return QString::fromUtf8(us.c_str());
}
/** Specialized version of the qt file dialog. Can't use getOpenFile()
etc. cause they hide dot files... */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment