summaryrefslogtreecommitdiffabout
path: root/korganizer/searchdialog.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/searchdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/searchdialog.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 9cfdc35..105b844 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -15,55 +15,62 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qcheckbox.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlabel.h>
-#include <qlistview.h>
-#include <qwhatsthis.h>
+#include <q3listview.h>
+#include <q3whatsthis.h>
#include <qlineedit.h>
#include <qpushbutton.h>
-#include <qhbuttongroup.h>
+//#include <qhbuttongroup.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3Frame>
+#include <Q3PtrList>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kmessagebox.h>
#include <libkdepim/kdateedit.h>
#include "koglobals.h"
#include "koprefs.h"
#include "klineedit.h"
#include "calendarview.h"
#include "koviewmanager.h"
#include "searchdialog.h"
SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
- : QVBox( 0 )
+ : Q3VBox( 0 )
{
mCalendar = calendar;
- QFrame *topFrame = new QFrame( this ) ;//plainPage();
- QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
+ Q3Frame *topFrame = new Q3Frame( this ) ;//plainPage();
+ Q3VBoxLayout *layout = new Q3VBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
// Search expression
- QHBoxLayout *subLayout = new QHBoxLayout();
+ Q3HBoxLayout *subLayout = new Q3HBoxLayout();
layout->addLayout(subLayout);
/*
searchLabel = new QLabel(topFrame);
searchLabel->setText(i18n("Search for:"));
subLayout->addWidget(searchLabel);
*/
QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame );
//OkButton->setDefault( true );
connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
subLayout->addWidget(OkButton);
searchEdit = new KLineEdit(topFrame);
subLayout->addWidget(searchEdit);
@@ -89,62 +96,62 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes()));
togButton->setPixmap(SmallIcon("1updownarrow"));
togButton->setMinimumWidth( togButton->sizeHint().height() );
searchEdit->setText("*"); // Find all events by default
searchEdit->setFocus();
connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
// Subjects to search
// QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
// topFrame);
- incidenceGroup = new QHBox( topFrame );
+ incidenceGroup = new Q3HBox( topFrame );
layout->addWidget(incidenceGroup);
mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
//mSearchEvent->setChecked(true);
mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
- subjectGroup = new QHBox( topFrame );
+ subjectGroup = new Q3HBox( topFrame );
layout->addWidget(subjectGroup);
mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
mSummaryCheck->setChecked(true);
mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
- attendeeGroup = new QHBox( topFrame );
+ attendeeGroup = new Q3HBox( topFrame );
layout->addWidget(attendeeGroup );
new QLabel( i18n("Attendee:"),attendeeGroup );
mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
// Date range
// QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
// topFrame);
// layout->addWidget(rangeGroup);
QWidget *rangeWidget = new QWidget(topFrame);
int space = KDialog::spacingHint();
if ( QApplication::desktop()->width() <= 240 ) space = 1;
- QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space);
+ Q3HBoxLayout *rangeLayout = new Q3HBoxLayout(rangeWidget,0,space);
rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
mStartDate = new KDateEdit(rangeWidget);
rangeLayout->addWidget(mStartDate);
rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
mEndDate = new KDateEdit(rangeWidget);
mEndDate->setDate(QDate::currentDate().addDays(365));
rangeLayout->addWidget(mEndDate);
- QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
+ QToolButton *wt = Q3WhatsThis::whatsThisButton ( rangeWidget );
rangeLayout->addWidget( (QWidget*)wt );
layout->addWidget(rangeWidget);
// Results list view
listView = new KOListView(mCalendar,topFrame);
layout->addWidget(listView);
listView->showCompletedTodos();
//layout->setStretchFactor( listView, 333 );
//listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
//listView->setMaximumHeight( 50 );
listView->readSettings(KOGlobals::config(),"SearchListView Layout");
connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
@@ -332,25 +339,25 @@ void SearchDialog::updateView()
mMatchedJournals.clear();
if (re.isValid()) {
search(re);
}
listView->setStartDate( mStartDate->date() );
listView->showEvents(mMatchedEvents);
listView->addTodos(mMatchedTodos);
listView->addJournals(mMatchedJournals);
}
void SearchDialog::search(const QRegExp &re)
{
- QPtrList<Event> events;
+ Q3PtrList<Event> events;
if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
if ( mRefineItems->isChecked() ) events = mMatchedEvents;
mMatchedEvents.clear();
}
if ( mSearchEvent->isChecked() ) {
if ( !mRefineItems->isChecked() )
events = mCalendar->events( mStartDate->date(),
mEndDate->date(),
false /*mInclusiveCheck->isChecked()*/ );
Event *ev;
@@ -410,25 +417,25 @@ void SearchDialog::search(const QRegExp &re)
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else{
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
continue;
}
}
if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
- QPtrList<Attendee> tmpAList = ev->attendees();
+ Q3PtrList<Attendee> tmpAList = ev->attendees();
Attendee *a;
for (a = tmpAList.first(); a; a = tmpAList.next()) {
if (mSearchAName->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(a->name()) != -1)
#else
if (re.match(a->name()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else{
@@ -449,25 +456,25 @@ void SearchDialog::search(const QRegExp &re)
mMatchedEvents.remove(ev);
else{
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
break;
}
}
}
}
}
}
- QPtrList<Todo> todos;
+ Q3PtrList<Todo> todos;
if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
if ( mRefineItems->isChecked() ) todos = mMatchedTodos ;
mMatchedTodos.clear();
}
if ( mSearchTodo->isChecked() ) {
if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
Todo *tod;
for(tod=todos.first();tod;tod=todos.next()) {
if (mSummaryCheck->isChecked()) {
#if QT_VERSION >= 0x030000
@@ -503,25 +510,25 @@ void SearchDialog::search(const QRegExp &re)
#else
if (re.match(tod->categoriesStr()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
continue;
}
}
if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
- QPtrList<Attendee> tmpAList = tod->attendees();
+ Q3PtrList<Attendee> tmpAList = tod->attendees();
Attendee *a;
for (a = tmpAList.first(); a; a = tmpAList.next()) {
if (mSearchAName->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(a->name()) != -1)
#else
if (re.match(a->name()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
@@ -539,25 +546,25 @@ void SearchDialog::search(const QRegExp &re)
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
break;
}
}
}
}
}
}
- QPtrList<Journal> journals;
+ Q3PtrList<Journal> journals;
if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
if ( mRefineItems->isChecked() ) journals = mMatchedJournals ;
mMatchedJournals.clear();
}
if (mSearchJournal->isChecked() ) {
if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals();
Journal* journ;
for(journ=journals.first();journ;journ=journals.next()) {
if ( journ->dtStart().date() <= mEndDate->date()
&&journ->dtStart().date() >= mStartDate->date()) {
if (mDescriptionCheck->isChecked()) {