diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 2681ccac..f8ffd521 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -868,7 +868,13 @@ bool RclConfig::setMimeViewerDef(const string& mt, const string& def) { if (mimeview == 0) return false; - if (!mimeview->set(mt, def, "view")) { + bool status; + if (!def.empty()) + status = mimeview->set(mt, def, "view"); + else + status = mimeview->erase(mt, "view"); + + if (!status) { m_reason = string("RclConfig:: cant set value. Readonly?"); return false; } diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index a973af1d..3d80bb86 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -167,40 +167,6 @@ - - - - Use desktop preferences to choose document editor. - - - false - - - - - - - - - Exceptions - - - Mime types that should not be passed to xdg-open even when "Use desktop preferences" is set.<br> Useful to pass page number and search string options to, e.g. evince. - - - - - - - - 70 - 0 - - - - - - diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index c17f003c..f7de447f 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -84,10 +84,6 @@ void UIPrefsDialog::init() ssAutoSpaceCB, SLOT(setDisabled(bool))); connect(ssAutoAllCB, SIGNAL(toggled(bool)), ssAutoSpaceCB, SLOT(setChecked(bool))); - connect(useDesktopOpenCB, SIGNAL(toggled(bool)), - viewActionPB, SLOT(setDisabled(bool))); - connect(useDesktopOpenCB, SIGNAL(toggled(bool)), - allExLE, SLOT(setEnabled(bool))); setFromPrefs(); } @@ -108,12 +104,6 @@ void UIPrefsDialog::setFromPrefs() initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen); - // External editor. Can use desktop prefs or internal - useDesktopOpenCB->setChecked(prefs.useDesktopOpen); - viewActionPB->setEnabled(!prefs.useDesktopOpen); - allExLE->setEnabled(prefs.useDesktopOpen); - allExLE->setText(QString::fromUtf8(theconfig->getMimeViewerAllEx().c_str())); - keepSortCB->setChecked(prefs.keepSort); previewHtmlCB->setChecked(prefs.previewHtml); switch (prefs.previewPlainPre) { @@ -255,8 +245,6 @@ void UIPrefsDialog::accept() replAbsCB->isChecked(); prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked(); - prefs.useDesktopOpen = useDesktopOpenCB->isChecked(); - theconfig->setMimeViewerAllEx((const char*)allExLE->text().toUtf8()); prefs.keepSort = keepSortCB->isChecked(); prefs.previewHtml = previewHtmlCB->isChecked(); diff --git a/src/qtgui/viewaction.ui b/src/qtgui/viewaction.ui index 89244507..4d29bd2c 100644 --- a/src/qtgui/viewaction.ui +++ b/src/qtgui/viewaction.ui @@ -6,107 +6,151 @@ 0 0 - 446 - 180 + 632 + 726 Native Viewers - + - + + + Select one or several mime types then use the controls in the bottom frame to change how they are processed. + + + false + + + + + + + Use Desktop preferences by default + + + + + + + Select one or several file types, then use the controls in the frame below to change how they are processed + + + QFrame::StyledPanel + + + QFrame::Sunken + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::SelectRows + + + true + + + true + + + 2 + + + true + + + true + + + 150 + + + true + + + true + + + false + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + 2 + + + + + + + + Exception to Desktop preferences + + + + + + + + + Action (empty -> recoll default) + + + + + + + + + + + + Apply to current selection + + + + + + + + + + - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - Select one or several mime types then click "Change Action"<br>You can also close this dialog and check "Use desktop preferences"<br>in the main panel to ignore this list and use your desktop defaults. - - - false + Close - - - - Select one or several file types, then click Change Action to modify the program used to open them - - - QFrame::StyledPanel - - - QFrame::Sunken - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectRows - - - true - - - true - - - 2 - - - true - - - true - - - 150 - - - true - - - true - - - false - - - false - - - true - - - true - - - 150 - - - - - - - - - - - Change Action - - - - - - - Close - - - - - diff --git a/src/qtgui/viewaction_w.cpp b/src/qtgui/viewaction_w.cpp index b6c47d3a..ae7b9cbf 100644 --- a/src/qtgui/viewaction_w.cpp +++ b/src/qtgui/viewaction_w.cpp @@ -14,6 +14,9 @@ * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include + #include #include #include @@ -38,12 +41,28 @@ using namespace std; void ViewAction::init() { connect(closePB, SIGNAL(clicked()), this, SLOT(close())); - connect(chgActPB, SIGNAL(clicked()), - this, SLOT(editActions())); + connect(chgActPB, SIGNAL(clicked()), this, SLOT(editActions())); connect(actionsLV,SIGNAL(itemDoubleClicked(QTableWidgetItem *)), this, SLOT(onItemDoubleClicked(QTableWidgetItem *))); + useDesktopCB->setChecked(prefs.useDesktopOpen); + onUseDesktopCBToggled(prefs.useDesktopOpen); + connect(useDesktopCB, SIGNAL(stateChanged(int)), + this, SLOT(onUseDesktopCBToggled(int))); + connect(setExceptCB, SIGNAL(stateChanged(int)), + this, SLOT(onSetExceptCBToggled(int))); + resize(QSize(640, 480).expandedTo(minimumSizeHint())); +} + +void ViewAction::onUseDesktopCBToggled(int onoff) +{ + prefs.useDesktopOpen = onoff != 0; fillLists(); - resize(QSize(640, 250).expandedTo(minimumSizeHint())); + setExceptCB->setEnabled(prefs.useDesktopOpen); +} + +void ViewAction::onSetExceptCBToggled(int onoff) +{ + newActionLE->setEnabled(onoff != 0); } void ViewAction::fillLists() @@ -54,12 +73,25 @@ void ViewAction::fillLists() theconfig->getMimeViewerDefs(defs); actionsLV->setRowCount(defs.size()); int row = 0; + + set viewerXs; + if (prefs.useDesktopOpen) { + string s = theconfig->getMimeViewerAllEx(); + stringToStrings(s, viewerXs); + } for (vector >::const_iterator it = defs.begin(); it != defs.end(); it++) { actionsLV->setItem(row, 0, new QTableWidgetItem(QString::fromAscii(it->first.c_str()))); - actionsLV->setItem(row, 1, - new QTableWidgetItem(QString::fromAscii(it->second.c_str()))); + if (!prefs.useDesktopOpen || + viewerXs.find(it->first) != viewerXs.end()) { + actionsLV->setItem( + row, 1, + new QTableWidgetItem(QString::fromAscii(it->second.c_str()))); + } else { + actionsLV->setItem( + row, 1, new QTableWidgetItem(tr("Desktop Default"))); + } row++; } QStringList labels(tr("MIME type")); @@ -78,6 +110,7 @@ void ViewAction::selectMT(const QString& mt) actionsLV->setCurrentItem(*it, QItemSelectionModel::Columns); } } + void ViewAction::onItemDoubleClicked(QTableWidgetItem * item) { actionsLV->clearSelection(); @@ -90,21 +123,30 @@ void ViewAction::onItemDoubleClicked(QTableWidgetItem * item) void ViewAction::editActions() { QString action0; + int except0 = -1; + + set viewerXs; + string s = theconfig->getMimeViewerAllEx(); + stringToStrings(s, viewerXs); + list mtypes; bool dowarnmultiple = true; for (int row = 0; row < actionsLV->rowCount(); row++) { QTableWidgetItem *item0 = actionsLV->item(row, 0); if (!item0->isSelected()) continue; - mtypes.push_back((const char *)item0->text().toLocal8Bit()); + string mtype = (const char *)item0->text().toLocal8Bit(); + mtypes.push_back(mtype); QTableWidgetItem *item1 = actionsLV->item(row, 1); QString action = item1->text(); + int except = viewerXs.find(mtype) != viewerXs.end(); if (action0.isEmpty()) { action0 = action; + except0 = except; } else { - if (action != action0 && dowarnmultiple) { + if ((action != action0 || except != except0) && dowarnmultiple) { switch (QMessageBox::warning(0, "Recoll", - tr("Changing actions with " + tr("Changing entries with " "different current values"), "Continue", "Cancel", @@ -118,17 +160,26 @@ void ViewAction::editActions() if (action0.isEmpty()) return; - bool ok; - QString newaction = QInputDialog::getText(this, "Recoll", "Edit action:", - QLineEdit::Normal, - action0, &ok); - if (!ok || newaction.isEmpty() ) - return; - - string sact = (const char *)newaction.toLocal8Bit(); - for (list::const_iterator it = mtypes.begin(); - it != mtypes.end(); it++) { - theconfig->setMimeViewerDef(*it, sact); + string sact = (const char *)newActionLE->text().toLocal8Bit(); + trimstring(sact); + for (list::const_iterator mit = mtypes.begin(); + mit != mtypes.end(); mit++) { + set::iterator xit = viewerXs.find(*mit); + if (setExceptCB->isChecked()) { + if (xit == viewerXs.end()) { + viewerXs.insert(*mit); + } + } else { + if (xit != viewerXs.end()) { + viewerXs.erase(xit); + } + } + // An empty action will restore the default (erase from + // topmost conftree) + theconfig->setMimeViewerDef(*mit, sact); } + + s = stringsToString(viewerXs); + theconfig->setMimeViewerAllEx(s); fillLists(); } diff --git a/src/qtgui/viewaction_w.h b/src/qtgui/viewaction_w.h index 7852da2d..e3cae77d 100644 --- a/src/qtgui/viewaction_w.h +++ b/src/qtgui/viewaction_w.h @@ -43,6 +43,8 @@ public: public slots: virtual void editActions(); virtual void onItemDoubleClicked(QTableWidgetItem *); + virtual void onUseDesktopCBToggled(int); + virtual void onSetExceptCBToggled(int); private: virtual void init(); virtual void fillLists(); diff --git a/website/doc.html b/website/doc.html index 7eb273f9..db3eddad 100644 --- a/website/doc.html +++ b/website/doc.html @@ -49,7 +49,7 @@
  • Indexing PDF XMP-metadata: a nice exemple of customizing a Recoll configuration and the PDF filter to use additional - metadata.
  • + metadata, by Jeffrey Dick.
  • Index size and indexing performance data.
  • Result list format samples.
  • diff --git a/website/recoll_XMP/index.html b/website/recoll_XMP/index.html index 5fdfaf3c..6b577cee 100644 --- a/website/recoll_XMP/index.html +++ b/website/recoll_XMP/index.html @@ -80,9 +80,11 @@ journal = < ' --- > ' | -168a200,203 +168a200,205 > # replace latex with html markup > l2html | +> # replace "Subject" with "Abstract" +> sed -e s/\<meta\ name=\"Subject\"/\<meta\ name=\"Abstract\"/g | > # add markup="html" to author meta element > sed -e s/\<meta\ name=\"Author\"/\<meta\ name=\"Author\"\ markup=\"html\"/g