Gui: restable browser section links work

This commit is contained in:
Jean-Francois Dockes 2010-12-22 19:25:31 +01:00
parent 0a6063542f
commit 1e6fde221d
5 changed files with 64 additions and 10 deletions

View File

@ -133,6 +133,7 @@
<addaction name="toolsDoc_HistoryAction"/> <addaction name="toolsDoc_HistoryAction"/>
<addaction name="toolsAdvanced_SearchAction"/> <addaction name="toolsAdvanced_SearchAction"/>
<addaction name="toolsSpellAction"/> <addaction name="toolsSpellAction"/>
<addaction name="actionShowQueryDetails"/>
</widget> </widget>
<widget class="QMenu" name="preferencesMenu"> <widget class="QMenu" name="preferencesMenu">
<property name="title"> <property name="title">
@ -212,7 +213,7 @@
</action> </action>
<action name="toolsDoc_HistoryAction"> <action name="toolsDoc_HistoryAction">
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/history.png</normaloff>:/images/history.png</iconset> <normaloff>:/images/history.png</normaloff>:/images/history.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -227,7 +228,7 @@
</action> </action>
<action name="toolsAdvanced_SearchAction"> <action name="toolsAdvanced_SearchAction">
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/asearch.png</normaloff>:/images/asearch.png</iconset> <normaloff>:/images/asearch.png</normaloff>:/images/asearch.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -253,7 +254,7 @@
</action> </action>
<action name="toolsSpellAction"> <action name="toolsSpellAction">
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/spell.png</normaloff>:/images/spell.png</iconset> <normaloff>:/images/spell.png</normaloff>:/images/spell.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -271,7 +272,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/nextpage.png</normaloff>:/images/nextpage.png</iconset> <normaloff>:/images/nextpage.png</normaloff>:/images/nextpage.png</iconset>
</property> </property>
<property name="iconText"> <property name="iconText">
@ -292,7 +293,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/firstpage.png</normaloff>:/images/firstpage.png</iconset> <normaloff>:/images/firstpage.png</normaloff>:/images/firstpage.png</iconset>
</property> </property>
<property name="iconText"> <property name="iconText">
@ -313,7 +314,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/prevpage.png</normaloff>:/images/prevpage.png</iconset> <normaloff>:/images/prevpage.png</normaloff>:/images/prevpage.png</iconset>
</property> </property>
<property name="iconText"> <property name="iconText">
@ -378,7 +379,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="recoll.qrc">
<normaloff>:/images/up.png</normaloff>:/images/up.png</iconset> <normaloff>:/images/up.png</normaloff>:/images/up.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -406,6 +407,11 @@
<string>Sort by dates from newest to oldest</string> <string>Sort by dates from newest to oldest</string>
</property> </property>
</action> </action>
<action name="actionShowQueryDetails">
<property name="text">
<string>Show Query Details</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="2" margin="2"/> <layoutdefault spacing="2" margin="2"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>

View File

@ -242,6 +242,8 @@ void RclMain::init()
this, SLOT(catgFilter(int))); this, SLOT(catgFilter(int)));
connect(toggleFullScreenAction, SIGNAL(activated()), connect(toggleFullScreenAction, SIGNAL(activated()),
this, SLOT(toggleFullScreen())); this, SLOT(toggleFullScreen()));
connect(actionShowQueryDetails, SIGNAL(activated()),
this, SLOT(showQueryDetails()));
connect(periodictimer, SIGNAL(timeout()), connect(periodictimer, SIGNAL(timeout()),
this, SLOT(periodic100())); this, SLOT(periodic100()));
@ -259,6 +261,10 @@ void RclMain::init()
connect(restable->getModel(), SIGNAL(sortDataChanged(DocSeqSortSpec)), connect(restable->getModel(), SIGNAL(sortDataChanged(DocSeqSortSpec)),
this, SLOT(onResTableSortBy(DocSeqSortSpec))); this, SLOT(onResTableSortBy(DocSeqSortSpec)));
connect(restable, SIGNAL(docEditClicked(Rcl::Doc)),
this, SLOT(startNativeViewer(Rcl::Doc)));
connect(restable, SIGNAL(docPreviewClicked(int, Rcl::Doc, int)),
this, SLOT(startPreview(int, Rcl::Doc, int)));
connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)), connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)),
reslist, SLOT(setDocSource(RefCntr<DocSequence>))); reslist, SLOT(setDocSource(RefCntr<DocSequence>)));

View File

@ -248,6 +248,13 @@ void ResTable::init()
m_pager = new ResTablePager(this); m_pager = new ResTablePager(this);
QSettings settings; QSettings settings;
splitter->restoreState(settings.value("resTableSplitterSizes").toByteArray()); splitter->restoreState(settings.value("resTableSplitterSizes").toByteArray());
textBrowser->setReadOnly(TRUE);
textBrowser->setUndoRedoEnabled(FALSE);
textBrowser->setOpenLinks(FALSE);
// signals and slots connections
connect(textBrowser, SIGNAL(anchorClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &)));
} }
void ResTable::saveSizeState() void ResTable::saveSizeState()
@ -287,7 +294,7 @@ void ResTable::setDocSource(RefCntr<DocSequence> nsource)
if (m_model) if (m_model)
m_model->setDocSource(nsource); m_model->setDocSource(nsource);
if (m_pager) if (m_pager)
m_pager->setDocSource(nsource); m_pager->setDocSource(nsource, 0);
if (textBrowser) if (textBrowser)
textBrowser->clear(); textBrowser->clear();
} }
@ -323,3 +330,32 @@ void ResTable::readDocSource()
{ {
m_model->setDocSource(m_model->m_source); m_model->setDocSource(m_model->m_source);
} }
void ResTable::linkWasClicked(const QUrl &url)
{
QString s = url.toString();
const char *ascurl = s.toAscii();
LOGDEB(("ResTable::linkWasClicked: [%s]\n", ascurl));
int i = atoi(ascurl+1) -1;
int what = ascurl[0];
switch (what) {
case 'P':
case 'E':
{
Rcl::Doc doc;
if (!m_model->getdoc(i, doc)) {
LOGERR(("ResTable::linkWasClicked: can't get doc for %d\n", i));
return;
}
if (what == 'P')
emit docPreviewClicked(i, doc, 0);
else
emit docEditClicked(doc);
}
break;
default:
LOGERR(("ResList::linkWasClicked: bad link [%s]\n", ascurl));
break;// ??
}
}

View File

@ -58,6 +58,7 @@ private:
}; };
class ResTablePager; class ResTablePager;
class QUrl;
class ResTable : public QWidget, public Ui::ResTable class ResTable : public QWidget, public Ui::ResTable
{ {
@ -84,6 +85,11 @@ public slots:
virtual void resetSource(); virtual void resetSource();
virtual void readDocSource(); virtual void readDocSource();
virtual void onSortDataChanged(DocSeqSortSpec); virtual void onSortDataChanged(DocSeqSortSpec);
virtual void linkWasClicked(const QUrl&);
signals:
void docPreviewClicked(int, Rcl::Doc, int);
void docEditClicked(Rcl::Doc);
friend class ResTablePager; friend class ResTablePager;
private: private:

View File

@ -23,10 +23,10 @@ public:
{ {
m_hiliter = ptr; m_hiliter = ptr;
} }
void setDocSource(RefCntr<DocSequence> src) void setDocSource(RefCntr<DocSequence> src, int winfirst = -1)
{ {
m_pagesize = m_newpagesize; m_pagesize = m_newpagesize;
m_winfirst = -1; m_winfirst = winfirst;
m_hasNext = false; m_hasNext = false;
m_docSource = src; m_docSource = src;
m_respage.clear(); m_respage.clear();