about dialog, remember previous mainwin geometry
This commit is contained in:
parent
b31976558a
commit
add9ba1234
@ -1,11 +1,11 @@
|
||||
# @(#$Id: Makefile,v 1.14 2005-11-12 14:31:39 dockes Exp $ (C) 2005 J.F.Dockes
|
||||
# @(#$Id: Makefile,v 1.15 2005-11-16 08:17:10 dockes Exp $ (C) 2005 J.F.Dockes
|
||||
|
||||
# Default values. These can be overridden on the command line ie:
|
||||
# make PREFIX=/usr
|
||||
PREFIX=/usr/local
|
||||
INSTALL = install -c
|
||||
|
||||
all: mk/sysconf
|
||||
all: mk/sysconf common/rclversion.h
|
||||
cd lib; ${MAKE}
|
||||
cd bincimapmime; ${MAKE}
|
||||
cd index; rm -f recollindex; ${MAKE} recollindex
|
||||
@ -16,6 +16,11 @@ all: mk/sysconf
|
||||
mk/sysconf:
|
||||
./configure
|
||||
|
||||
common/rclversion.h: VERSION
|
||||
(echo -n "static const char *rclversion= \"" && \
|
||||
echo -n `cat VERSION` && \
|
||||
echo "\";") > common/rclversion.h
|
||||
|
||||
static:
|
||||
cd lib; ${MAKE}
|
||||
cd bincimapmime; ${MAKE}
|
||||
|
||||
@ -1 +1,3 @@
|
||||
1.0.5
|
||||
1.0.6
|
||||
|
||||
|
||||
|
||||
@ -1,22 +1,21 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.13 2005-11-06 15:07:09 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.14 2005-11-16 08:17:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <qtranslator.h>
|
||||
#include <qtextcodec.h>
|
||||
|
||||
|
||||
#include <qtranslator.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qthread.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <qmessagebox.h>
|
||||
#include <qsettings.h>
|
||||
|
||||
|
||||
#include "rcldb.h"
|
||||
using Rcl::AdvSearchData;
|
||||
|
||||
#include "rclconfig.h"
|
||||
#include "pathut.h"
|
||||
#include "recoll.h"
|
||||
@ -62,8 +61,19 @@ bool maybeOpenDb(string &reason)
|
||||
return true;
|
||||
}
|
||||
|
||||
RecollMain *mainWindow;
|
||||
|
||||
void recollCleanup()
|
||||
{
|
||||
QSettings settings;
|
||||
if (mainWindow) {
|
||||
int width = mainWindow->width();
|
||||
int height = mainWindow->height();
|
||||
settings.setPath("Recoll.org", "Recoll");
|
||||
settings.writeEntry( "/Recoll/geometry/width", width);
|
||||
settings.writeEntry("/Recoll/geometry/height", height);
|
||||
}
|
||||
|
||||
stop_idxthread();
|
||||
delete rcldb;
|
||||
rcldb = 0;
|
||||
@ -85,17 +95,44 @@ static void sigcleanup(int)
|
||||
recollNeedsExit = 1;
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
// translation file for Qt
|
||||
QTranslator qt( 0 );
|
||||
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
||||
a.installTranslator( &qt );
|
||||
|
||||
// Translations for Recoll
|
||||
QTranslator translator( 0 );
|
||||
// QTextCodec::locale() return $LANG
|
||||
// QTextCodec::locale() returns $LANG
|
||||
translator.load( QString("recoll_") + QTextCodec::locale(), "." );
|
||||
a.installTranslator( &translator );
|
||||
|
||||
// Restore some settings from previous session
|
||||
QSettings settings;
|
||||
settings.setPath("Recoll.org", "Recoll");
|
||||
int width = settings.readNumEntry( "/Recoll/geometry/width", 590);
|
||||
int height = settings.readNumEntry( "/Recoll/geometry/height", 810);
|
||||
QSize s(width, height);
|
||||
|
||||
// Create main window and set its size to previous session's
|
||||
RecollMain w;
|
||||
w.show();
|
||||
mainWindow = &w;
|
||||
w.resize(s);
|
||||
|
||||
|
||||
#if 0
|
||||
// Once tried to set a lighter background but this doesn;t seem to work
|
||||
// (no inheritance from buttons and popups)
|
||||
QPalette palette = w.palette();
|
||||
palette.setColor(QColorGroup::Background, QColor(239,239,239));
|
||||
w.setPalette(palette);
|
||||
#endif
|
||||
|
||||
// Connect exit handlers etc..
|
||||
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
|
||||
QTimer *timer = new QTimer(&a);
|
||||
w.connect(timer, SIGNAL(timeout()), &w, SLOT(periodic100()));
|
||||
@ -105,10 +142,9 @@ int main( int argc, char ** argv )
|
||||
rclconfig = recollinit(recollCleanup, sigcleanup, reason);
|
||||
|
||||
if (!rclconfig || !rclconfig->ok()) {
|
||||
string msg = "Configuration problem: ";
|
||||
QString msg = a.translate("Main", "Configuration problem: ");
|
||||
msg += reason;
|
||||
QMessageBox::critical(0, "Recoll",
|
||||
QString(msg.c_str()));
|
||||
QMessageBox::critical(0, "Recoll", msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -117,13 +153,15 @@ int main( int argc, char ** argv )
|
||||
// Note: this will have to be replaced by a call to a
|
||||
// configuration buildin dialog for initial configuration
|
||||
QMessageBox::critical(0, "Recoll",
|
||||
QString("No db directory in configuration"));
|
||||
a.translate("Main",
|
||||
"No db directory in configuration"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!maketmpdir(tmpdir)) {
|
||||
QMessageBox::critical(0, "Recoll",
|
||||
QString("Cannot create temporary directory"));
|
||||
a.translate("Main",
|
||||
"Cannot create temporary directory"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -134,11 +172,16 @@ int main( int argc, char ** argv )
|
||||
if (!rcldb || !rcldb->open(dbdir, Rcl::Db::DbRO)) {
|
||||
startindexing = 1;
|
||||
QMessageBox::information(0, "Recoll",
|
||||
QString("Could not open database in ") +
|
||||
QString(dbdir) + ". Starting indexation");
|
||||
a.translate("Main",
|
||||
"Could not open database in ") +
|
||||
QString(dbdir) +
|
||||
a.translate("Main",
|
||||
". Starting indexation"));
|
||||
}
|
||||
|
||||
start_idxthread(rclconfig);
|
||||
|
||||
// Let's go
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@ -187,6 +187,7 @@
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="local" impldecl="in implementation">qapplication.h</include>
|
||||
<include location="local" impldecl="in declaration">rcldb.h</include>
|
||||
<include location="local" impldecl="in implementation">preview.ui.h</include>
|
||||
</includes>
|
||||
<variables>
|
||||
@ -205,11 +206,13 @@
|
||||
<slot>prevPressed()</slot>
|
||||
<slot>currentChanged( QWidget * tw )</slot>
|
||||
<slot>closeCurrentTab()</slot>
|
||||
<slot>setCurTabProps( const Rcl::Doc & doc )</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function>closeEvent( QCloseEvent * e )</function>
|
||||
<function returnType="bool">eventFilter( QObject * target, QEvent * event )</function>
|
||||
<function returnType="QTextEdit *">addEditorTab()</function>
|
||||
</functions>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
||||
@ -184,3 +184,44 @@ void Preview::closeCurrentTab()
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTextEdit * Preview::addEditorTab()
|
||||
{
|
||||
QWidget *anon = new QWidget((QWidget *)pvTab);
|
||||
QVBoxLayout *anonLayout = new QVBoxLayout(anon, 1, 1, "anonLayout");
|
||||
QTextEdit *editor = new QTextEdit(anon, "pvEdit");
|
||||
editor->setReadOnly( TRUE );
|
||||
editor->setUndoRedoEnabled( FALSE );
|
||||
anonLayout->addWidget(editor);
|
||||
pvTab->addTab(anon, "Tab");
|
||||
pvTab->showPage(anon);
|
||||
return editor;
|
||||
}
|
||||
|
||||
using std::string;
|
||||
|
||||
void Preview::setCurTabProps(const Rcl::Doc &doc)
|
||||
{
|
||||
QString title = QString::fromUtf8(doc.title.c_str(),
|
||||
doc.title.length());
|
||||
if (title.length() > 20) {
|
||||
title = title.left(10) + "..." + title.right(10);
|
||||
}
|
||||
pvTab->changeTab(pvTab->currentPage(), title);
|
||||
|
||||
char datebuf[100];
|
||||
datebuf[0] = 0;
|
||||
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
|
||||
time_t mtime = doc.dmtime.empty() ?
|
||||
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
|
||||
struct tm *tm = localtime(&mtime);
|
||||
strftime(datebuf, 99, "%F %T", tm);
|
||||
}
|
||||
string tiptxt = doc.url + string("\n");
|
||||
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
|
||||
if (!doc.title.empty())
|
||||
tiptxt += doc.title + "\n";
|
||||
pvTab->setTabToolTip(pvTab->currentPage(),
|
||||
QString::fromUtf8(tiptxt.c_str(), tiptxt.length()));
|
||||
}
|
||||
|
||||
@ -1,155 +1,174 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>Preview</name>
|
||||
<message>
|
||||
<source>Preview</source>
|
||||
<translation>Previsualisation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Preview 1</source>
|
||||
<translation>Previsualisation 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Search for:</source>
|
||||
<translation>&Rechercher:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Next</source>
|
||||
<translation>&Suivant</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alt+N</source>
|
||||
<translation>Alt+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Previous</source>
|
||||
<translation>&Precédent</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alt+P</source>
|
||||
<translation>Alt+P</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Match &Case</source>
|
||||
<translation>Respecter la &casse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alt+C</source>
|
||||
<translation>Alt+C</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close Tab</source>
|
||||
<translation>Fermer la tabulation</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecollMain</name>
|
||||
<message>
|
||||
<source>recoll</source>
|
||||
<translation>recoll</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Search</source>
|
||||
<translation>Rechercher</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear</source>
|
||||
<translation>Effacer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+S</source>
|
||||
<translation>Ctrl+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Previous page</source>
|
||||
<translation>Page précedente</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Next page</source>
|
||||
<translation>Page suivante</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Advanced search</source>
|
||||
<translation>Recherche avancée</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&File</source>
|
||||
<translation>&Fichier</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Exit</source>
|
||||
<translation>Quitter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>E&xit</source>
|
||||
<translation>&Quitter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Indexing</source>
|
||||
<translation>Commencer l'indexation</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>advsearch</name>
|
||||
<message>
|
||||
<source>Advanced search</source>
|
||||
<translation>Recherche avancée</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Search For</source>
|
||||
<translation>Rechercher</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>All these words</source>
|
||||
<translation>Tous les mots</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This exact phrase</source>
|
||||
<translation>Cette phrase exactement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Any of these words</source>
|
||||
<translation>N'importe lequel de ces mots</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None of these words</source>
|
||||
<translation>Aucun parmi ces mots</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restrict file types</source>
|
||||
<translation>Restraindre le type de fichier</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Searched file types</source>
|
||||
<translation>Type de fichier recherché</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--------></source>
|
||||
<translation>--------></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><---------</source>
|
||||
<translation><---------</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ignored file types</source>
|
||||
<translation>Types de fichier ignorés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Browse</source>
|
||||
<translation>ButinerParcourir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restrict results to files in subtree:</source>
|
||||
<translation>Restraindre les résultats aux fichiers de l'arborescenc:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Search</source>
|
||||
<translation>Lancer la recherche</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Dismiss</source>
|
||||
<translation>Annuler</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>Main</name>
|
||||
<message>
|
||||
<source>Configuration problem: </source>
|
||||
<translation>Problème de configuration: </translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Preview</name>
|
||||
<message>
|
||||
<source>Preview</source>
|
||||
<translation>Previsualisation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Preview 1</source>
|
||||
<translation>Previsualisation 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Search for:</source>
|
||||
<translation>&Rechercher:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Next</source>
|
||||
<translation>&Suivant</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alt+N</source>
|
||||
<translation>Alt+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Previous</source>
|
||||
<translation>&Precédent</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alt+P</source>
|
||||
<translation>Alt+P</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Match &Case</source>
|
||||
<translation>Respecter la &casse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alt+C</source>
|
||||
<translation>Alt+C</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close Tab</source>
|
||||
<translation type="obsolete">Fermer la tabulation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear</source>
|
||||
<translation>Effacer</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecollMain</name>
|
||||
<message>
|
||||
<source>recoll</source>
|
||||
<translation>recoll</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Search</source>
|
||||
<translation>Rechercher</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear</source>
|
||||
<translation>Effacer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+S</source>
|
||||
<translation>Ctrl+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Previous page</source>
|
||||
<translation>Page précedente</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Next page</source>
|
||||
<translation>Page suivante</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Advanced search</source>
|
||||
<translation>Recherche avancée</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&File</source>
|
||||
<translation>&Fichier</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Exit</source>
|
||||
<translation>Quitter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>E&xit</source>
|
||||
<translation>&Quitter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Indexing</source>
|
||||
<translation>Commencer l'indexation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Help</source>
|
||||
<translation>Aide</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About Recoll</source>
|
||||
<translation>À propos de Recoll</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>advsearch</name>
|
||||
<message>
|
||||
<source>Advanced search</source>
|
||||
<translation>Recherche avancée</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Search For</source>
|
||||
<translation>Rechercher</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>All these words</source>
|
||||
<translation>Tous les mots</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This exact phrase</source>
|
||||
<translation>Cette phrase exactement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Any of these words</source>
|
||||
<translation>N'importe lequel de ces mots</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None of these words</source>
|
||||
<translation>Aucun parmi ces mots</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restrict file types</source>
|
||||
<translation>Restraindre le type de fichier</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Searched file types</source>
|
||||
<translation>Type de fichier recherché</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--------></source>
|
||||
<translation>--------></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><---------</source>
|
||||
<translation><---------</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ignored file types</source>
|
||||
<translation>Types de fichier ignorés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Browse</source>
|
||||
<translation>ButinerParcourir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restrict results to files in subtree:</source>
|
||||
<translation>Restraindre les résultats aux fichiers de l'arborescenc:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Search</source>
|
||||
<translation>Lancer la recherche</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Dismiss</source>
|
||||
<translation>Annuler</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>590</width>
|
||||
<height>810</height>
|
||||
<width>631</width>
|
||||
<height>212</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -181,12 +181,16 @@
|
||||
<cstring>MenuBar</cstring>
|
||||
</property>
|
||||
<item text="&File" name="fileMenu">
|
||||
<separator/>
|
||||
<separator/>
|
||||
<action name="fileStart_IndexingAction"/>
|
||||
<separator/>
|
||||
<action name="fileExitAction"/>
|
||||
</item>
|
||||
<separator/>
|
||||
<item text="&Help" name="Help">
|
||||
<separator/>
|
||||
<action name="helpAbout_RecollAction"/>
|
||||
</item>
|
||||
</menubar>
|
||||
<toolbars>
|
||||
</toolbars>
|
||||
@ -216,6 +220,17 @@
|
||||
<string>Start Indexing</string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>helpAbout_RecollAction</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About Recoll</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>About Recoll</string>
|
||||
</property>
|
||||
</action>
|
||||
</actions>
|
||||
<connections>
|
||||
<connection>
|
||||
@ -278,6 +293,12 @@
|
||||
<receiver>RecollMain</receiver>
|
||||
<slot>advSearchPB_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>helpAbout_RecollAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>RecollMain</receiver>
|
||||
<slot>showAboutDialog()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="local" impldecl="in declaration">preview.h</include>
|
||||
@ -314,6 +335,7 @@
|
||||
<slot>advSearchPB_clicked()</slot>
|
||||
<slot>startAdvSearch( Rcl::AdvSearchData sdata )</slot>
|
||||
<slot>reslistTE_delayedclick()</slot>
|
||||
<slot>showAboutDialog()</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private">init()</function>
|
||||
|
||||
@ -38,6 +38,7 @@ using std::pair;
|
||||
#include "plaintorich.h"
|
||||
#include "unacpp.h"
|
||||
#include "advsearch.h"
|
||||
#include "rclversion.h"
|
||||
|
||||
extern "C" int XFlush(void *);
|
||||
|
||||
@ -49,7 +50,6 @@ extern "C" int XFlush(void *);
|
||||
// with the default window size and font, most of the time.
|
||||
static const int respagesize = 8;
|
||||
|
||||
|
||||
void RecollMain::init()
|
||||
{
|
||||
reslist_current = -1;
|
||||
@ -212,7 +212,7 @@ void RecollMain::periodic100()
|
||||
rcldb->close();
|
||||
} else if (indexingdone == 0) {
|
||||
if (toggle < 9) {
|
||||
statusBar()->message("Indexing in progress");
|
||||
statusBar()->message(tr("Indexing in progress"));
|
||||
} else {
|
||||
statusBar()->message("");
|
||||
}
|
||||
@ -251,9 +251,8 @@ void RecollMain::reslistTE_doubleClicked(int par, int)
|
||||
string cmd = getMimeViewer(doc.mimetype, rclconfig->getMimeConf());
|
||||
if (cmd.length() == 0) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
QString("No external viewer configured for mime"
|
||||
" type ") +
|
||||
doc.mimetype.c_str());
|
||||
tr("No external viewer configured for mime type ")
|
||||
+ doc.mimetype.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -281,8 +280,8 @@ void RecollMain::reslistTE_doubleClicked(int par, int)
|
||||
ncmd += " &";
|
||||
QStatusBar *stb = statusBar();
|
||||
if (stb) {
|
||||
string msg = string("Executing: [") + ncmd.c_str() + "]";
|
||||
stb->message(msg.c_str(), 5000);
|
||||
QString msg = tr("Executing: [") + ncmd.c_str() + "]";
|
||||
stb->message(msg, 5000);
|
||||
stb->repaint(false);
|
||||
XFlush(qt_xdisplay());
|
||||
}
|
||||
@ -399,10 +398,10 @@ void RecollMain::listNextPB_clicked()
|
||||
}
|
||||
if (i == 0) {
|
||||
reslistTE->append("<qt><head></head><body><p>");
|
||||
char line[80];
|
||||
sprintf(line, "<p><b>Displaying results starting at index"
|
||||
" %d (maximum set size %d)</b><br>",
|
||||
reslist_winfirst+1, resCnt);
|
||||
QString line = tr("<p><b>Displaying results starting at index"
|
||||
" %1 (maximum set size %2)</b><br>")
|
||||
.arg(reslist_winfirst+1)
|
||||
.arg(resCnt);
|
||||
reslistTE->append(line);
|
||||
}
|
||||
|
||||
@ -448,7 +447,7 @@ void RecollMain::listNextPB_clicked()
|
||||
reslistTE->ensureCursorVisible();
|
||||
} else {
|
||||
// Restore first in win parameter that we shouln't have incremented
|
||||
reslistTE->append("<p><b>No results found</b><br>");
|
||||
reslistTE->append(tr("<p><b>No results found</b><br>"));
|
||||
reslist_winfirst -= respagesize;
|
||||
if (reslist_winfirst < 0)
|
||||
reslist_winfirst = -1;
|
||||
@ -473,7 +472,7 @@ void RecollMain::previewClosed(Preview *w)
|
||||
void RecollMain::advSearchPB_clicked()
|
||||
{
|
||||
if (asearchform == 0) {
|
||||
asearchform = new advsearch(0, "Advanced search", FALSE,
|
||||
asearchform = new advsearch(0, tr("Advanced search"), FALSE,
|
||||
WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu);
|
||||
asearchform->setSizeGripEnabled(FALSE);
|
||||
@ -540,14 +539,18 @@ void RecollMain::reslistTE_delayedclick()
|
||||
}
|
||||
|
||||
|
||||
// Open a preview window for a given document
|
||||
// docnum is a db query index
|
||||
/**
|
||||
* Open a preview window for a given document, or load it into new tab of
|
||||
* existing window.
|
||||
*
|
||||
* @param docnum db query index
|
||||
*/
|
||||
void RecollMain::startPreview(int docnum)
|
||||
{
|
||||
Rcl::Doc doc;
|
||||
if (!rcldb->getDoc(docnum, doc, 0)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
QString("Cannot retrieve document info"
|
||||
tr("Cannot retrieve document info"
|
||||
" from database"));
|
||||
return;
|
||||
}
|
||||
@ -558,28 +561,57 @@ void RecollMain::startPreview(int docnum)
|
||||
struct stat st;
|
||||
if (stat(fn.c_str(), &st) < 0) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
QString("Cannot access document file: ") +
|
||||
tr("Cannot access document file: ") +
|
||||
fn.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
QStatusBar *stb = statusBar();
|
||||
|
||||
stb->message(tr("Creating preview window"));
|
||||
qApp->processEvents();
|
||||
QTextEdit *editor;
|
||||
if (curPreview == 0) {
|
||||
curPreview = new Preview(0, tr("Preview"));
|
||||
curPreview->setCaption(queryText->text());
|
||||
connect(curPreview, SIGNAL(previewClosed(Preview *)),
|
||||
this, SLOT(previewClosed(Preview *)));
|
||||
if (curPreview == 0) {
|
||||
QMessageBox::warning(0, tr("Warning"),
|
||||
tr("Can't create preview window"),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
editor = curPreview->pvEdit;
|
||||
curPreview->show();
|
||||
} else {
|
||||
editor = curPreview->addEditorTab();
|
||||
}
|
||||
|
||||
if (doc.title.empty())
|
||||
doc.title = path_getsimple(doc.url);
|
||||
|
||||
curPreview->setCurTabProps(doc);
|
||||
|
||||
char csz[20];
|
||||
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
||||
string msg = string("Loading: ") + fn + " (size " + csz + " bytes)";
|
||||
stb->message(msg.c_str());
|
||||
QString msg = QString("Loading: %1 (size %2 bytes)")
|
||||
.arg(fn)
|
||||
.arg(csz);
|
||||
stb->message(msg);
|
||||
qApp->processEvents();
|
||||
|
||||
Rcl::Doc fdoc;
|
||||
FileInterner interner(fn, rclconfig, tmpdir, &doc.mimetype);
|
||||
if (interner.internfile(fdoc, doc.ipath) != FileInterner::FIDone) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
QString("Can't turn doc into internal rep for ") +
|
||||
tr("Can't turn doc into internal rep for ") +
|
||||
doc.mimetype.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
stb->message("Creating preview text");
|
||||
stb->message(tr("Creating preview text"));
|
||||
qApp->processEvents();
|
||||
|
||||
list<string> terms;
|
||||
@ -587,72 +619,13 @@ void RecollMain::startPreview(int docnum)
|
||||
list<pair<int, int> > termoffsets;
|
||||
string rich = plaintorich(fdoc.text, terms, termoffsets);
|
||||
|
||||
stb->message("Creating preview window");
|
||||
qApp->processEvents();
|
||||
QTextEdit *editor;
|
||||
if (curPreview == 0) {
|
||||
curPreview = new Preview(0, "Preview");
|
||||
curPreview->setCaption(queryText->text());
|
||||
connect(curPreview, SIGNAL(previewClosed(Preview *)),
|
||||
this, SLOT(previewClosed(Preview *)));
|
||||
if (curPreview == 0) {
|
||||
QMessageBox::warning(0, "Warning",
|
||||
"Can't create preview window",
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
curPreview->show();
|
||||
editor = curPreview->pvEdit;
|
||||
} else {
|
||||
QWidget *anon = new QWidget((QWidget *)curPreview->pvTab);
|
||||
QVBoxLayout *anonLayout = new QVBoxLayout(anon, 1, 1, "anonLayout");
|
||||
editor = new QTextEdit(anon, "pvEdit");
|
||||
editor->setReadOnly( TRUE );
|
||||
editor->setUndoRedoEnabled( FALSE );
|
||||
anonLayout->addWidget(editor);
|
||||
curPreview->pvTab->addTab(anon, "Tab");
|
||||
curPreview->pvTab->showPage(anon);
|
||||
}
|
||||
string tabname;
|
||||
if (!doc.title.empty()) {
|
||||
tabname = doc.title;
|
||||
} else {
|
||||
tabname = path_getsimple(doc.url);
|
||||
}
|
||||
if (tabname.length() > 20) {
|
||||
tabname = tabname.substr(0, 10) + "..." +
|
||||
tabname.substr(tabname.length()-10);
|
||||
}
|
||||
curPreview->pvTab->changeTab(curPreview->pvTab->currentPage(),
|
||||
QString::fromUtf8(tabname.c_str(),
|
||||
tabname.length()));
|
||||
|
||||
if (doc.title.empty())
|
||||
doc.title = path_getsimple(doc.url);
|
||||
char datebuf[100];
|
||||
datebuf[0] = 0;
|
||||
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
|
||||
time_t mtime = doc.dmtime.empty() ?
|
||||
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
|
||||
struct tm *tm = localtime(&mtime);
|
||||
strftime(datebuf, 99, "%F %T", tm);
|
||||
}
|
||||
string tiptxt = doc.url + string("\n");
|
||||
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
|
||||
if (!doc.title.empty())
|
||||
tiptxt += doc.title + "\n";
|
||||
curPreview->pvTab->setTabToolTip(curPreview->pvTab->currentPage(),
|
||||
QString::fromUtf8(tiptxt.c_str(),
|
||||
tiptxt.length()));
|
||||
|
||||
QStyleSheetItem *item =
|
||||
new QStyleSheetItem(editor->styleSheet(), "termtag" );
|
||||
item->setColor("blue");
|
||||
item->setFontWeight(QFont::Bold);
|
||||
|
||||
QString str = QString::fromUtf8(rich.c_str(), rich.length());
|
||||
stb->message("Loading preview text");
|
||||
stb->message(tr("Loading preview text"));
|
||||
qApp->processEvents();
|
||||
|
||||
editor->setText(str);
|
||||
@ -669,3 +642,11 @@ void RecollMain::startPreview(int docnum)
|
||||
editor->length(), editor->paragraphs(), para, index));
|
||||
stb->clear();
|
||||
}
|
||||
|
||||
|
||||
void RecollMain::showAboutDialog()
|
||||
{
|
||||
string vstring = string("Recoll ") + rclversion +
|
||||
"<br>" + "http://www.recoll.org";
|
||||
QMessageBox::information(this, tr("About Recoll"), vstring.c_str());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user