|
a/src/qtgui/viewaction_w.cpp |
|
b/src/qtgui/viewaction_w.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: viewaction_w.cpp,v 1.2 2006-12-18 12:05:29 dockes Exp $ (C) 2006 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: viewaction_w.cpp,v 1.3 2006-12-18 16:45:52 dockes Exp $ (C) 2006 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
21 |
#include <utility>
|
21 |
#include <utility>
|
22 |
#include <string>
|
22 |
#include <string>
|
23 |
|
23 |
|
24 |
using namespace std;
|
24 |
using namespace std;
|
25 |
|
25 |
|
26 |
#include <qcombobox.h>
|
|
|
27 |
#include <qspinbox.h>
|
|
|
28 |
#include <qcheckbox.h>
|
|
|
29 |
#include <qpushbutton.h>
|
26 |
#include <qpushbutton.h>
|
|
|
27 |
#include <qtimer.h>
|
|
|
28 |
|
|
|
29 |
#if (QT_VERSION < 0x040000)
|
30 |
#include <qlistview.h>
|
30 |
#include <qlistview.h>
|
|
|
31 |
#else
|
31 |
#include <qlayout.h>
|
32 |
#include <q3listview.h>
|
|
|
33 |
#define QListView Q3ListView
|
|
|
34 |
#define QListViewItem Q3ListViewItem
|
|
|
35 |
#define QListViewItemIterator Q3ListViewItemIterator
|
|
|
36 |
#endif
|
|
|
37 |
|
32 |
#include <qmessagebox.h>
|
38 |
#include <qmessagebox.h>
|
33 |
#include <qinputdialog.h>
|
39 |
#include <qinputdialog.h>
|
34 |
|
40 |
|
35 |
#include "recoll.h"
|
41 |
#include "recoll.h"
|
36 |
#include "debuglog.h"
|
42 |
#include "debuglog.h"
|
|
... |
|
... |
40 |
|
46 |
|
41 |
void ViewAction::init()
|
47 |
void ViewAction::init()
|
42 |
{
|
48 |
{
|
43 |
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
|
49 |
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
|
44 |
connect(chgActPB, SIGNAL(clicked()), this, SLOT(editAction()));
|
50 |
connect(chgActPB, SIGNAL(clicked()), this, SLOT(editAction()));
|
|
|
51 |
connect(actionsLV,
|
|
|
52 |
#if (QT_VERSION < 0x040000)
|
45 |
connect(actionsLV,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
|
53 |
SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
|
|
|
54 |
#else
|
|
|
55 |
SIGNAL(doubleClicked(Q3ListViewItem *, const QPoint &, int)),
|
|
|
56 |
#endif
|
46 |
this, SLOT(editAction()));
|
57 |
this, SLOT(editAction()));
|
|
|
58 |
|
|
|
59 |
// Note: could get the column width setting to work in qt4
|
|
|
60 |
actionsLV->setColumnWidthMode(0, QListView::Manual);
|
|
|
61 |
actionsLV->setColumnWidth(0, 300);
|
|
|
62 |
actionsLV->setColumnWidthMode(1, QListView::Manual);
|
|
|
63 |
actionsLV->setColumnWidth(1, 120);
|
|
|
64 |
|
47 |
fillLists();
|
65 |
fillLists();
|
48 |
actionsLV->setColumnWidth(0, 150);
|
66 |
resize(QSize(450, 250).expandedTo(minimumSizeHint()) );
|
49 |
actionsLV->setColumnWidth(1, 150);
|
|
|
50 |
resize(550,350);
|
|
|
51 |
}
|
67 |
}
|
|
|
68 |
|
52 |
void ViewAction::fillLists()
|
69 |
void ViewAction::fillLists()
|
53 |
{
|
70 |
{
|
54 |
actionsLV->clear();
|
71 |
actionsLV->clear();
|
55 |
vector<pair<string, string> > defs;
|
72 |
vector<pair<string, string> > defs;
|
56 |
rclconfig->getMimeViewerDefs(defs);
|
73 |
rclconfig->getMimeViewerDefs(defs);
|
|
... |
|
... |
59 |
new QListViewItem(actionsLV,
|
76 |
new QListViewItem(actionsLV,
|
60 |
QString::fromAscii(it->first.c_str()),
|
77 |
QString::fromAscii(it->first.c_str()),
|
61 |
QString::fromAscii(it->second.c_str()));
|
78 |
QString::fromAscii(it->second.c_str()));
|
62 |
}
|
79 |
}
|
63 |
|
80 |
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
// To avoid modifying the listview state from the dbl click signal, as
|
|
|
84 |
// advised by the manual
|
|
|
85 |
void ViewAction::listDblClicked()
|
|
|
86 |
{
|
|
|
87 |
QTimer::singleShot(0, this, SLOT(editAction()));
|
64 |
}
|
88 |
}
|
65 |
|
89 |
|
66 |
void ViewAction::editAction()
|
90 |
void ViewAction::editAction()
|
67 |
{
|
91 |
{
|
68 |
QString action0;
|
92 |
QString action0;
|