clarified the dialog used to choose viewer apps

This commit is contained in:
Jean-Francois Dockes 2013-05-23 07:56:27 +02:00
parent 360c3b4f2b
commit 89603e6244
4 changed files with 115 additions and 7 deletions

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>632</width>
<width>635</width>
<height>726</height>
</rect>
</property>
@ -82,20 +82,67 @@
<column/>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Recoll action:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="currentLBL">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string>current value</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="selSamePB">
<property name="text">
<string>Select same</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>2</number>
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_new">
<property name="text">
<string>&lt;b&gt;New Values:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="setExceptCB">
<property name="text">
@ -108,7 +155,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Action (empty -> recoll default)</string>
<string>Action (empty -&gt; recoll default)</string>
</property>
</widget>
</item>

View File

@ -40,16 +40,21 @@ using namespace std;
void ViewAction::init()
{
selSamePB->setEnabled(false);
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
connect(chgActPB, SIGNAL(clicked()), this, SLOT(editActions()));
connect(actionsLV,SIGNAL(itemDoubleClicked(QTableWidgetItem *)),
this, SLOT(onItemDoubleClicked(QTableWidgetItem *)));
connect(actionsLV,SIGNAL(itemClicked(QTableWidgetItem *)),
this, SLOT(onItemClicked(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)));
connect(selSamePB, SIGNAL(clicked()),
this, SLOT(onSelSameClicked()));
resize(QSize(640, 480).expandedTo(minimumSizeHint()));
}
@ -67,6 +72,7 @@ void ViewAction::onSetExceptCBToggled(int onoff)
void ViewAction::fillLists()
{
currentLBL->clear();
actionsLV->clear();
actionsLV->verticalHeader()->setDefaultSectionSize(20);
vector<pair<string, string> > defs;
@ -111,6 +117,51 @@ void ViewAction::selectMT(const QString& mt)
}
}
void ViewAction::onSelSameClicked()
{
fprintf(stderr, "onSelSameClicked()\n");
actionsLV->clearSelection();
QString value = currentLBL->text();
if (value.isEmpty())
return;
string action = qs2utf8s(value);
fprintf(stderr, "value: %s\n", action.c_str());
vector<pair<string, string> > defs;
theconfig->getMimeViewerDefs(defs);
for (unsigned int i = 0; i < defs.size(); i++) {
if (defs[i].second == action) {
QList<QTableWidgetItem *>items =
actionsLV->findItems(QString::fromAscii(defs[i].first.c_str()),
Qt::MatchFixedString|Qt::MatchCaseSensitive);
for (QList<QTableWidgetItem *>::iterator it = items.begin();
it != items.end(); it++) {
(*it)->setSelected(true);
QTableWidgetItem *item1 = actionsLV->item((*it)->row(), 1);
item1->setSelected(true);
}
}
}
}
// Fill the input fields with the row's values when the user clicks
void ViewAction::onItemClicked(QTableWidgetItem * item)
{
QTableWidgetItem *item0 = actionsLV->item(item->row(), 0);
string mtype = (const char *)item0->text().toLocal8Bit();
vector<pair<string, string> > defs;
theconfig->getMimeViewerDefs(defs);
for (unsigned int i = 0; i < defs.size(); i++) {
if (defs[i].first == mtype) {
currentLBL->setText(QString::fromAscii(defs[i].second.c_str()));
selSamePB->setEnabled(true);
return;
}
}
currentLBL->clear();
selSamePB->setEnabled(false);
}
void ViewAction::onItemDoubleClicked(QTableWidgetItem * item)
{
actionsLV->clearSelection();

View File

@ -42,9 +42,11 @@ public:
public slots:
virtual void editActions();
virtual void onItemClicked(QTableWidgetItem *);
virtual void onItemDoubleClicked(QTableWidgetItem *);
virtual void onUseDesktopCBToggled(int);
virtual void onSetExceptCBToggled(int);
virtual void onSelSameClicked();
private:
virtual void init();
virtual void fillLists();

View File

@ -44,8 +44,16 @@ versions.</i></p>
Preferences-&gt;Query configuration-&gt;User interface </blockquote>
and erase the result paragraph format string (^A DEL in the text area),
this will reset the string to the default value.</li>
<li>A release 1.19 change in the way we handle minus characters
('-') broke support for wildcard character ranges (e.g.: <tt>[a-z]</tt>).
A fix would be relatively complicated, so please speak up if you
need it because I won't probably do it without further
motivation.</li>
<li>Real time indexer: when running with gamin on FreeBSD, the indexer can
deadlock in the gamin dialog in some cases.</li>
<li>After an upgrade, the recoll GUI sometimes crashes on startup. This is
fixed by removing (back it up just in case)
~/.config/Recoll.org/recoll.conf, the QSettings storage for recoll.</li>