diff --git a/src/qtgui/advsearch.ui b/src/qtgui/advsearch.ui index 59f27244..06afe389 100644 --- a/src/qtgui/advsearch.ui +++ b/src/qtgui/advsearch.ui @@ -8,8 +8,8 @@ 0 0 - 0 - 0 + 515 + 475 @@ -147,16 +147,25 @@ - + - clauseVBox + clauseFRM + + + StyledPanel + + + Plain unnamed + + 0 + - 2 + 0 @@ -218,12 +227,12 @@ saveFileTypesPB - - Save as default - false + + Save as default + false diff --git a/src/qtgui/advsearch_w.cpp b/src/qtgui/advsearch_w.cpp index f8285208..3d622c1b 100644 --- a/src/qtgui/advsearch_w.cpp +++ b/src/qtgui/advsearch_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.14 2006-12-04 06:19:10 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.15 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -26,10 +26,11 @@ static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.14 2006-12-04 06:19:10 dockes #include #include -#include #if (QT_VERSION < 0x040000) +#include #include #else +#include #include #endif @@ -194,11 +195,11 @@ void AdvSearch::addClause() void AdvSearch::addClause(int tp) { - SearchClauseW *w = new SearchClauseW(this); + SearchClauseW *w = new SearchClauseW(clauseFRM); m_clauseWins.push_back(w); connect(w->wordsLE, SIGNAL(returnPressed()), this, SLOT(searchPB_clicked())); - clauseVBox->addWidget(w); + ((QVBoxLayout *)(clauseFRM->layout()))->addWidget(w); w->show(); w->tpChange(tp); if (m_clauseWins.size() > iclausescnt) { @@ -207,7 +208,7 @@ void AdvSearch::addClause(int tp) delClausePB->setEnabled(false); } // Have to adjust the size else we lose the bottom buttons! Why? - QSize sz = AdvSearchBaseLayout->sizeHint(); + QSize sz = layout()->sizeHint(); resize(QSize(sz.width()+HORADJ, sz.height()+VERTADJ)); } @@ -222,7 +223,7 @@ void AdvSearch::delClause() } else { delClausePB->setEnabled(false); } - QSize sz = AdvSearchBaseLayout->sizeHint(); + QSize sz = layout()->sizeHint(); resize(QSize(sz.width()+HORADJ, sz.height()+VERTADJ)); } @@ -310,15 +311,23 @@ void AdvSearch::searchPB_clicked() } if (!subtreeCMB->currentText().isEmpty()) { + QString current = subtreeCMB->currentText(); sdata->setTopdir((const char*)subtreeCMB->currentText().utf8()); - // The listbox is set for no insertion, do it. Have to check - // for dups as the internal feature seems to only work for - // user-inserted strings - if (!subtreeCMB->listBox()->findItem(subtreeCMB->currentText(), - Qt::CaseSensitive|Qt::ExactMatch)) - subtreeCMB->insertItem(subtreeCMB->currentText(), 0); - // And keep it sorted - subtreeCMB->listBox()->sort(); + // Keep history list clean and sorted. Maybe there would be a + // simpler way to do this + list entries; + for (int i = 0; i < subtreeCMB->count(); i++) { + entries.push_back(subtreeCMB->text(i)); + } + entries.push_back(subtreeCMB->currentText()); + entries.sort(); + unique(entries.begin(), entries.end()); + subtreeCMB->clear(); + for (list::iterator it = entries.begin(); + it != entries.end(); it++) { + subtreeCMB->insertItem(*it); + } + subtreeCMB->setCurrentText(current); prefs.asearchSubdirHist.clear(); for (int index = 0; index < subtreeCMB->count(); index++) prefs.asearchSubdirHist.push_back(subtreeCMB->text(index)); diff --git a/src/qtgui/advsearch_w.h b/src/qtgui/advsearch_w.h index c9553785..57452241 100644 --- a/src/qtgui/advsearch_w.h +++ b/src/qtgui/advsearch_w.h @@ -1,6 +1,6 @@ #ifndef _ADVSEARCH_W_H_INCLUDED_ #define _ADVSEARCH_W_H_INCLUDED_ -/* @(#$Id: advsearch_w.h,v 1.8 2006-12-04 06:19:10 dockes Exp $ (C) 2005 J.F.Dockes */ +/* @(#$Id: advsearch_w.h,v 1.9 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +73,9 @@ public slots: virtual void addClause(); virtual void addClause(int); virtual bool close(); +#if (QT_VERSION < 0x040000) virtual void polish(); +#endif signals: void startSearch(RefCntr); diff --git a/src/qtgui/preview_w.cpp b/src/qtgui/preview_w.cpp index ac8a8e98..1ab2c48a 100644 --- a/src/qtgui/preview_w.cpp +++ b/src/qtgui/preview_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.8 2006-11-30 13:38:44 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.9 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -27,12 +27,19 @@ using std::pair; #endif /* NO_NAMESPACES */ #include -#include #include #include #include #include +#if (QT_VERSION < 0x040000) #include +#include +#else +#include +#include +#include +#endif +#include #include #include #include @@ -110,33 +117,34 @@ bool Preview::eventFilter(QObject *target, QEvent *event) LOGDEB1(("Preview::eventFilter: keyEvent\n")); QKeyEvent *keyEvent = (QKeyEvent *)event; - if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) { + if (keyEvent->key() == Qt::Key_Q && + (keyEvent->state() & Qt::ControlButton)) { recollNeedsExit = 1; return true; - } else if (keyEvent->key() == Key_Escape) { + } else if (keyEvent->key() == Qt::Key_Escape) { close(); return true; } else if (keyEvent->key() == Qt::Key_Down && - (keyEvent->state() & ShiftButton)) { + (keyEvent->state() & Qt::ShiftButton)) { // LOGDEB(("Preview::eventFilter: got Shift-Up\n")); TabData *d = tabDataForCurrent(); if (d) emit(showNext(m_searchId, d->docnum)); return true; } else if (keyEvent->key() == Qt::Key_Up && - (keyEvent->state() & ShiftButton)) { + (keyEvent->state() & Qt::ShiftButton)) { // LOGDEB(("Preview::eventFilter: got Shift-Down\n")); TabData *d = tabDataForCurrent(); if (d) emit(showPrev(m_searchId, d->docnum)); return true; - } else if (keyEvent->key() == Key_W && - (keyEvent->state() & ControlButton)) { + } else if (keyEvent->key() == Qt::Key_W && + (keyEvent->state() & Qt::ControlButton)) { // LOGDEB(("Preview::eventFilter: got ^W\n")); closeCurrentTab(); return true; } else if (dynSearchActive) { - if (keyEvent->key() == Key_F3) { + if (keyEvent->key() == Qt::Key_F3) { doSearch(searchTextLine->text(), true, false); return true; } @@ -146,9 +154,9 @@ bool Preview::eventFilter(QObject *target, QEvent *event) QWidget *tw = pvTab->currentPage(); QWidget *e = 0; if (tw) - e = (QTextEdit *)tw->child("pvEdit"); + e = (QWidget *)tw->child("pvEdit"); LOGDEB1(("Widget: %p, edit %p, target %p\n", tw, e, target)); - if (e && target == tw && keyEvent->key() == Key_Slash) { + if (e && target == tw && keyEvent->key() == Qt::Key_Slash) { searchTextLine->setFocus(); dynSearchActive = true; return true; @@ -175,6 +183,12 @@ void Preview::searchTextLine_textChanged(const QString & text) } } +#if (QT_VERSION >= 0x040000) +#define QTextEdit Q3TextEdit +#define QProgressDialog Q3ProgressDialog +#define QStyleSheetItem Q3StyleSheetItem +#endif + QTextEdit *Preview::getCurrentEditor() { QWidget *tw = pvTab->currentPage(); @@ -537,8 +551,13 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc, for (prog = 1;;prog++) { waiter.start(); waiter.wait(); +#if (QT_VERSION < 0x040000) if (lthr.finished()) break; +#else + if (lthr.isFinished()) + break; +#endif progress.setProgress(prog , prog <= nsteps-1 ? nsteps : prog+1); qApp->processEvents(); if (progress.wasCanceled()) { @@ -569,8 +588,13 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc, for (;;prog++) { waiter.start(); waiter.wait(); - if (rthr.finished()) - break; +#if (QT_VERSION < 0x040000) + if (rthr.finished()) + break; +#else + if (rthr.isFinished()) + break; +#endif progress.setProgress(prog , prog <= nsteps-1 ? nsteps : prog+1); qApp->processEvents(); if (progress.wasCanceled()) { @@ -609,7 +633,7 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc, progress.setLabelText(tr("Loading preview text into editor")); qApp->processEvents(); int l = 0; - for (unsigned int pos = 0; pos < richTxt.length(); pos += l, prog++) { + for (int pos = 0; pos < (int)richTxt.length(); pos += l, prog++) { progress.setProgress(prog , prog <= nsteps-1 ? nsteps : prog+1); qApp->processEvents(); diff --git a/src/qtgui/preview_w.h b/src/qtgui/preview_w.h index 8ad8e406..9cb1f956 100644 --- a/src/qtgui/preview_w.h +++ b/src/qtgui/preview_w.h @@ -1,6 +1,6 @@ #ifndef _PREVIEW_W_H_INCLUDED_ #define _PREVIEW_W_H_INCLUDED_ -/* @(#$Id: preview_w.h,v 1.5 2006-12-04 06:19:11 dockes Exp $ (C) 2006 J.F.Dockes */ +/* @(#$Id: preview_w.h,v 1.6 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include "preview.h" #else #include "ui_preview.h" +#define QTextEdit Q3TextEdit #endif #include "refcntr.h" #include "searchdata.h" diff --git a/src/qtgui/sort_w.cpp b/src/qtgui/sort_w.cpp index 83303608..72ff8134 100644 --- a/src/qtgui/sort_w.cpp +++ b/src/qtgui/sort_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.2 2006-09-21 09:37:28 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.3 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -31,13 +31,18 @@ static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.2 2006-09-21 09:37:28 dockes Exp $ void SortForm::init() { - const char *labels[5]; - labels[0] = ""; - labels[1] = "Date"; - labels[2] = "Mime type"; - labels[3] = 0; - fldCMB1->insertStrList(labels, 3); - fldCMB2->insertStrList(labels, 3); + QStringList slabs; + slabs += QString(); + slabs += tr("Date"); + slabs += tr("Mime type"); + +#if QT_VERSION < 0x040000 + fldCMB1->insertStringList(slabs); + fldCMB2->insertStringList(slabs); +#else + fldCMB1->addItems(slabs); + fldCMB2->addItems(slabs); +#endif // Initialize values from prefs: mcntSB->setValue(prefs.sortWidth); diff --git a/src/qtgui/ssearch_w.cpp b/src/qtgui/ssearch_w.cpp index 96037c2f..e5ef76fa 100644 --- a/src/qtgui/ssearch_w.cpp +++ b/src/qtgui/ssearch_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.12 2006-11-30 13:38:44 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.13 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,7 @@ static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.12 2006-11-30 13:38:44 dockes E #include #include #include +#include #include "debuglog.h" #include "guiutils.h" @@ -210,11 +211,11 @@ bool SSearch::eventFilter(QObject *target, QEvent *event) QKeyEvent *ke = (QKeyEvent *)event; LOGDEB1(("SSearch::eventFilter: keyPress escape %d key %d\n", m_escape, ke->key())); - if (ke->key() == Key_Escape) { + if (ke->key() == Qt::Key_Escape) { LOGDEB(("Escape\n")); m_escape = true; return true; - } else if (m_escape && ke->key() == Key_Space) { + } else if (m_escape && ke->key() == Qt::Key_Space) { LOGDEB(("Escape space\n")); ke->accept(); completion(); diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 57586a24..0c865f18 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.11 2006-11-21 08:47:51 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.12 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -24,7 +24,6 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.11 2006-11-21 08:47:51 dockes E #include #include -#include #include #include #include @@ -36,7 +35,16 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.11 2006-11-21 08:47:51 dockes E #include #include #include +#if QT_VERSION < 0x040000 #include +#include +#else +#include +#include +#define QListBox Q3ListBox +#define QListBoxItem Q3ListBoxItem +#define QFileDialog Q3FileDialog +#endif #include #include #include @@ -241,7 +249,7 @@ void UIPrefsDialog::showBrowserDialog() this, "open file dialog", "Choose a file"); - if (s) + if (!s.isEmpty()) helpBrowserLE->setText(s); } @@ -268,7 +276,12 @@ void UIPrefsDialog::addADbPB_clicked() if (item && item->isSelected()) { allDbsLB->setSelected(i, false); if (!actDbsLB->findItem(item->text(), - Qt::CaseSensitive|Qt::ExactMatch)) { +#if QT_VERSION < 0x040000 + Qt::CaseSensitive|Qt::ExactMatch +#else + Q3ListBox::CaseSensitive|Q3ListBox::ExactMatch +#endif + )) { actDbsLB->insertItem(item->text()); } } @@ -343,7 +356,12 @@ void UIPrefsDialog::addExtraDbPB_clicked() return; } if (allDbsLB->findItem(extraDbLE->text(), - Qt::CaseSensitive|Qt::ExactMatch)) { +#if QT_VERSION < 0x040000 + Qt::CaseSensitive|Qt::ExactMatch +#else + Q3ListBox::CaseSensitive|Q3ListBox::ExactMatch +#endif + )) { QMessageBox::warning(0, "Recoll", tr("The selected directory is already in the index list")); return; @@ -361,6 +379,6 @@ void UIPrefsDialog::browseDbPB_clicked() tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)")); fdia.setShowHiddenFiles(savedh); - if (s) + if (!s.isEmpty()) extraDbLE->setText(s); } diff --git a/src/qtgui/uiprefs_w.h b/src/qtgui/uiprefs_w.h index 1da207d4..829339a0 100644 --- a/src/qtgui/uiprefs_w.h +++ b/src/qtgui/uiprefs_w.h @@ -1,4 +1,4 @@ -/* @(#$Id: uiprefs_w.h,v 1.3 2006-12-04 06:19:11 dockes Exp $ (C) 2006 J.F.Dockes */ +/* @(#$Id: uiprefs_w.h,v 1.4 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ #ifndef _UIPREFS_W_H_INCLUDED_ #define _UIPREFS_W_H_INCLUDED_ -/* @(#$Id: uiprefs_w.h,v 1.3 2006-12-04 06:19:11 dockes Exp $ (C) 2005 J.F.Dockes */ +/* @(#$Id: uiprefs_w.h,v 1.4 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes */ #include #include @@ -37,7 +37,7 @@ class DummyUIPrefsDialogBase : public UIPrefsDialogBase : UIPrefsDialogBase(parent) {} }; #else -class DummyUIPrefsDialogBase : public QWidget, protected Ui::UIPrefsDialogBase +class DummyUIPrefsDialogBase : public QDialog, protected Ui::UIPrefsDialogBase { public: DummyUIPrefsDialogBase(QDialog *parent) {setupUi(parent);} };