-rw-r--r-- | korganizer/kolistview.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 17 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 12 |
3 files changed, 21 insertions, 18 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e0e138e..341f473 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1162,89 +1162,89 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1162 | } | 1162 | } |
1163 | } | 1163 | } |
1164 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1164 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1165 | : KListView( lv, "kolistlistview", false ) | 1165 | : KListView( lv, "kolistlistview", false ) |
1166 | { | 1166 | { |
1167 | mPopupTimer = new QTimer(this); | 1167 | mPopupTimer = new QTimer(this); |
1168 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1168 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1169 | #ifndef DESKTOP_VERSION | 1169 | #ifndef DESKTOP_VERSION |
1170 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1170 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1171 | #endif | 1171 | #endif |
1172 | setSelectionMode( QListView::Multi ); | 1172 | setSelectionMode( QListView::Multi ); |
1173 | setMultiSelection( true); | 1173 | setMultiSelection( true); |
1174 | } | 1174 | } |
1175 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1175 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1176 | { | 1176 | { |
1177 | if (!e) return; | 1177 | if (!e) return; |
1178 | QPoint vp = contentsToViewport(e->pos()); | 1178 | QPoint vp = contentsToViewport(e->pos()); |
1179 | QListViewItem *item = itemAt(vp); | 1179 | QListViewItem *item = itemAt(vp); |
1180 | if (!item) { | 1180 | if (!item) { |
1181 | emit newEvent(); | 1181 | emit newEvent(); |
1182 | return; | 1182 | return; |
1183 | } | 1183 | } |
1184 | KListView::contentsMouseDoubleClickEvent(e); | 1184 | KListView::contentsMouseDoubleClickEvent(e); |
1185 | } | 1185 | } |
1186 | #if 0 | 1186 | #if 0 |
1187 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1187 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1188 | { | 1188 | { |
1189 | //qDebug("contentsMousePressEvent++++ "); | 1189 | //qDebug("contentsMousePressEvent++++ "); |
1190 | KListView::contentsMousePressEvent( e ); | 1190 | KListView::contentsMousePressEvent( e ); |
1191 | if ( e->button() == RightButton ) { | 1191 | if ( e->button() == RightButton ) { |
1192 | QListViewItem* ci = currentItem(); | 1192 | QListViewItem* ci = currentItem(); |
1193 | clearSelection () ; | 1193 | clearSelection () ; |
1194 | if ( ci ) | 1194 | if ( ci ) |
1195 | ci->setSelected( true ); | 1195 | ci->setSelected( true ); |
1196 | } | 1196 | } |
1197 | } | 1197 | } |
1198 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1198 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1199 | { | 1199 | { |
1200 | KListView::contentsMouseReleaseEvent(e); | 1200 | KListView::contentsMouseReleaseEvent(e); |
1201 | } | 1201 | } |
1202 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1202 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1203 | { | 1203 | { |
1204 | KListView::contentsMouseMoveEvent(e); | 1204 | KListView::contentsMouseMoveEvent(e); |
1205 | } | 1205 | } |
1206 | #endif | 1206 | #endif |
1207 | void KOListViewListView::popupMenu() | 1207 | void KOListViewListView::popupMenu() |
1208 | { | 1208 | { |
1209 | mPopupTimer->stop(); | 1209 | mPopupTimer->stop(); |
1210 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); | ||
1211 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1210 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); |
1212 | QApplication::postEvent( this->viewport(), e ); | 1211 | QApplication::postEvent( this->viewport(), e ); |
1212 | |||
1213 | } | 1213 | } |
1214 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1214 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1215 | { | 1215 | { |
1216 | //qDebug("contentsMousePressEvent++++ "); | 1216 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); |
1217 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1217 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1218 | if ( e->button() == LeftButton ) { | 1218 | if ( e->button() == LeftButton ) { |
1219 | mPopupTimer->start( 600 ); | 1219 | mPopupTimer->start( 600 ); |
1220 | mEventPos = e->pos(); | 1220 | mEventPos = contentsToViewport(e->pos()); |
1221 | mEventGlobalPos = e->globalPos(); | 1221 | mEventGlobalPos = e->globalPos(); |
1222 | } | 1222 | } |
1223 | KListView::contentsMousePressEvent( e ); | 1223 | KListView::contentsMousePressEvent( e ); |
1224 | if ( e->button() == RightButton ) { | 1224 | if ( e->button() == RightButton ) { |
1225 | QListViewItem* ci = currentItem(); | 1225 | QListViewItem* ci = currentItem(); |
1226 | //clearSelection(); | 1226 | //clearSelection(); |
1227 | if ( ci ) | 1227 | if ( ci ) |
1228 | ci->setSelected( true ); | 1228 | ci->setSelected( true ); |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1231 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1232 | { | 1232 | { |
1233 | mPopupTimer->stop(); | 1233 | mPopupTimer->stop(); |
1234 | KListView::contentsMouseReleaseEvent(e); | 1234 | KListView::contentsMouseReleaseEvent(e); |
1235 | } | 1235 | } |
1236 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1236 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1237 | { | 1237 | { |
1238 | // qDebug("contentsMouseMoveEv....... "); | 1238 | // qDebug("contentsMouseMoveEv....... "); |
1239 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1239 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1240 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1240 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1241 | if ( diff < 0 ) diff = -diff; | 1241 | if ( diff < 0 ) diff = -diff; |
1242 | if ( diff > 15 ) | 1242 | if ( diff > 15 ) |
1243 | mPopupTimer->stop(); | 1243 | mPopupTimer->stop(); |
1244 | else { | 1244 | else { |
1245 | mEventPos = e->pos(); | 1245 | mEventPos = contentsToViewport(e->pos()); |
1246 | mEventGlobalPos = e->globalPos(); | 1246 | mEventGlobalPos = e->globalPos(); |
1247 | } | 1247 | } |
1248 | KListView::contentsMouseMoveEvent(e); | 1248 | KListView::contentsMouseMoveEvent(e); |
1249 | } | 1249 | } |
1250 | 1250 | ||
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 8439b81..e72f94b 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -781,126 +781,123 @@ void KOPrefsDialog::setupViewsTab() | |||
781 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 781 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
782 | 782 | ||
783 | dummy = | 783 | dummy = |
784 | addWidBool(i18n("Categorie colors are applied to text"), | 784 | addWidBool(i18n("Categorie colors are applied to text"), |
785 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 785 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
786 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 786 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
787 | coloredCategoriesInMonthView = | 787 | coloredCategoriesInMonthView = |
788 | addWidBool(i18n("Month view uses day colors"), | 788 | addWidBool(i18n("Month view uses day colors"), |
789 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 789 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
790 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 790 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
791 | 791 | ||
792 | KPrefsDialogWidColor *holidayColor = | 792 | KPrefsDialogWidColor *holidayColor = |
793 | addWidColor(i18n("Day color odd months"), | 793 | addWidColor(i18n("Day color odd months"), |
794 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 794 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
795 | topLayout->addWidget(holidayColor->label(),ii,0); | 795 | topLayout->addWidget(holidayColor->label(),ii,0); |
796 | topLayout->addWidget(holidayColor->button(),ii++,1); | 796 | topLayout->addWidget(holidayColor->button(),ii++,1); |
797 | 797 | ||
798 | holidayColor = | 798 | holidayColor = |
799 | addWidColor(i18n("Day color even months"), | 799 | addWidColor(i18n("Day color even months"), |
800 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 800 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
801 | topLayout->addWidget(holidayColor->label(),ii,0); | 801 | topLayout->addWidget(holidayColor->label(),ii,0); |
802 | topLayout->addWidget(holidayColor->button(),ii++,1); | 802 | topLayout->addWidget(holidayColor->button(),ii++,1); |
803 | 803 | ||
804 | 804 | ||
805 | holidayColor = | 805 | holidayColor = |
806 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 806 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
807 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 807 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
808 | topLayout->addWidget(holidayColor->label(),ii,0); | 808 | topLayout->addWidget(holidayColor->label(),ii,0); |
809 | topLayout->addWidget(holidayColor->button(),ii++,1); | 809 | topLayout->addWidget(holidayColor->button(),ii++,1); |
810 | // *********************** What'sNext View | 810 | // *********************** What'sNext View |
811 | topFrame = addPage(i18n("What's Next View"),0,0); | 811 | topFrame = addPage(i18n("What's Next View"),0,0); |
812 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 812 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
813 | 813 | ||
814 | topLayout = new QGridLayout(topFrame,4,1); | 814 | topLayout = new QGridLayout(topFrame,4,1); |
815 | topLayout->setSpacing(mSpacingHint); | 815 | topLayout->setSpacing(mSpacingHint); |
816 | topLayout->setMargin(mMarginHint); | 816 | topLayout->setMargin(mMarginHint); |
817 | ii = 0; | 817 | ii = 0; |
818 | 818 | ||
819 | 819 | ||
820 | QHBox* hdummy = new QHBox(topFrame); | 820 | QHBox* hdummy = new QHBox(topFrame); |
821 | new QLabel(i18n("Days in What's Next:"),hdummy); | 821 | new QLabel(i18n("Days in What's Next:"),hdummy); |
822 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 822 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
823 | 823 | ||
824 | topLayout->addWidget(hdummy,ii++,0); | 824 | topLayout->addWidget(hdummy,ii++,0); |
825 | 825 | ||
826 | QHBox *prioBox = new QHBox(topFrame); | 826 | QHBox *prioBox = new QHBox(topFrame); |
827 | // intervalBox->setSpacing(mSpacingHint); | 827 | // intervalBox->setSpacing(mSpacingHint); |
828 | topLayout->addWidget(prioBox,ii++,0); | 828 | topLayout->addWidget(prioBox,ii++,0); |
829 | QString messa = i18n("Show topmost todo prios in What's Next:"); | 829 | |
830 | 830 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); | |
831 | if ( QApplication::desktop()->width() < 300 ) | ||
832 | messa = i18n("Show topmost todo prios in What's N.:"); | ||
833 | QLabel *prioLabel = new QLabel(messa, prioBox); | ||
834 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 831 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
835 | if ( QApplication::desktop()->width() < 300 ) | 832 | if ( QApplication::desktop()->width() < 300 ) |
836 | mPrioSpin->setFixedWidth( 40 ); | 833 | mPrioSpin->setFixedWidth( 40 ); |
837 | 834 | ||
838 | KPrefsDialogWidBool *passwdk = | 835 | KPrefsDialogWidBool *passwdk = |
839 | 836 | ||
840 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), | 837 | addWidBool(i18n("Show events, that are done"), |
841 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 838 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
842 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 839 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
843 | passwdk = | 840 | passwdk = |
844 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | 841 | addWidBool(i18n("Show parent To-Do's"), |
845 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 842 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
846 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 843 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
847 | 844 | ||
848 | passwdk = | 845 | passwdk = |
849 | addWidBool(i18n("Show location in What's Next view"), | 846 | addWidBool(i18n("Show location"), |
850 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 847 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
851 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 848 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
852 | 849 | ||
853 | passwdk = | 850 | passwdk = |
854 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), | 851 | addWidBool(i18n("Show Sync Events in WN+Agenda"), |
855 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 852 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
856 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 853 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
857 | passwdk = | 854 | passwdk = |
858 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), | 855 | addWidBool(i18n("Use short date in WN+Event view"), |
859 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 856 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
860 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 857 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
861 | 858 | ||
862 | 859 | ||
863 | 860 | ||
864 | 861 | ||
865 | // *********************** Todo View | 862 | // *********************** Todo View |
866 | 863 | ||
867 | topFrame = addPage(i18n("Todo View"),0,0); | 864 | topFrame = addPage(i18n("Todo View"),0,0); |
868 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 865 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
869 | 866 | ||
870 | topLayout = new QGridLayout(topFrame,4,1); | 867 | topLayout = new QGridLayout(topFrame,4,1); |
871 | topLayout->setSpacing(mSpacingHint); | 868 | topLayout->setSpacing(mSpacingHint); |
872 | topLayout->setMargin(mMarginHint); | 869 | topLayout->setMargin(mMarginHint); |
873 | ii = 0; | 870 | ii = 0; |
874 | dummy = | 871 | dummy = |
875 | addWidBool(i18n("Hide not running Todos in To-do view"), | 872 | addWidBool(i18n("Hide not running Todos in To-do view"), |
876 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 873 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
877 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 874 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
878 | 875 | ||
879 | 876 | ||
880 | KPrefsDialogWidBool *showCompletedTodo = | 877 | KPrefsDialogWidBool *showCompletedTodo = |
881 | addWidBool(i18n("To-do view shows completed Todos"), | 878 | addWidBool(i18n("To-do view shows completed Todos"), |
882 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 879 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
883 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 880 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
884 | dummy = | 881 | dummy = |
885 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 882 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
886 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 883 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
887 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 884 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
888 | 885 | ||
889 | dummy = | 886 | dummy = |
890 | addWidBool(i18n("Small To-do view uses smaller font"), | 887 | addWidBool(i18n("Small To-do view uses smaller font"), |
891 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 888 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
892 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 889 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
893 | 890 | ||
894 | 891 | ||
895 | 892 | ||
896 | dummy = | 893 | dummy = |
897 | addWidBool(i18n("Todo view uses category colors"), | 894 | addWidBool(i18n("Todo view uses category colors"), |
898 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 895 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
899 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 896 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
900 | 897 | ||
901 | 898 | ||
902 | QWidget* wid = new QWidget( topFrame ); | 899 | QWidget* wid = new QWidget( topFrame ); |
903 | // Todo due today color | 900 | // Todo due today color |
904 | KPrefsDialogWidColor *todoDueTodayColor = | 901 | KPrefsDialogWidColor *todoDueTodayColor = |
905 | addWidColor(i18n("Todo due today color:"), | 902 | addWidColor(i18n("Todo due today color:"), |
906 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 903 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index db60383..7a945e3 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -161,139 +161,145 @@ void SearchDialog::raiseAndSelect() | |||
161 | mSearchEvent->setChecked( false ); | 161 | mSearchEvent->setChecked( false ); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | else { | 164 | else { |
165 | if ( ! mSearchEvent->isChecked() ) { | 165 | if ( ! mSearchEvent->isChecked() ) { |
166 | mSearchEvent->setChecked( true ); | 166 | mSearchEvent->setChecked( true ); |
167 | mSearchJournal->setChecked( false ); | 167 | mSearchJournal->setChecked( false ); |
168 | mSearchTodo->setChecked( false ); | 168 | mSearchTodo->setChecked( false ); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | 171 | } |
172 | currentState = newState; | 172 | currentState = newState; |
173 | raise(); | 173 | raise(); |
174 | } | 174 | } |
175 | void SearchDialog::setFocusToList() | 175 | void SearchDialog::setFocusToList() |
176 | { | 176 | { |
177 | listView->resetFocus(); | 177 | listView->resetFocus(); |
178 | } | 178 | } |
179 | void SearchDialog::accept() | 179 | void SearchDialog::accept() |
180 | { | 180 | { |
181 | doSearch(); | 181 | doSearch(); |
182 | } | 182 | } |
183 | void SearchDialog::updateList() | 183 | void SearchDialog::updateList() |
184 | { | 184 | { |
185 | //listView->updateList(); | 185 | //listView->updateList(); |
186 | if ( isVisible() ) { | 186 | if ( isVisible() ) { |
187 | updateView(); | 187 | updateView(); |
188 | //qDebug("SearchDialog::updated "); | 188 | //qDebug("SearchDialog::updated "); |
189 | } | 189 | } |
190 | else { | 190 | else { |
191 | listView->clear(); | 191 | listView->clear(); |
192 | //qDebug("SearchDialog::cleared "); | 192 | //qDebug("SearchDialog::cleared "); |
193 | 193 | ||
194 | } | 194 | } |
195 | } | 195 | } |
196 | void SearchDialog::searchTextChanged( const QString &_text ) | 196 | void SearchDialog::searchTextChanged( const QString &_text ) |
197 | { | 197 | { |
198 | #if 0 | 198 | #if 0 |
199 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 199 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
200 | #endif | 200 | #endif |
201 | } | 201 | } |
202 | 202 | ||
203 | void SearchDialog::doSearch() | 203 | void SearchDialog::doSearch() |
204 | { | 204 | { |
205 | QRegExp re; | 205 | QRegExp re; |
206 | 206 | ||
207 | re.setWildcard(true); // most people understand these better. | 207 | re.setWildcard(true); // most people understand these better. |
208 | re.setCaseSensitive(false); | 208 | re.setCaseSensitive(false); |
209 | re.setPattern(searchEdit->text()); | 209 | QString st = searchEdit->text(); |
210 | if ( st.right(1) != "*") | ||
211 | st += "*"; | ||
212 | re.setPattern(st); | ||
210 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 213 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
211 | KMessageBox::sorry(this, | 214 | KMessageBox::sorry(this, |
212 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 215 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
213 | return; | 216 | return; |
214 | } | 217 | } |
215 | if (!re.isValid() ) { | 218 | if (!re.isValid() ) { |
216 | KMessageBox::sorry(this, | 219 | KMessageBox::sorry(this, |
217 | i18n("Invalid search expression,\ncannot perform " | 220 | i18n("Invalid search expression,\ncannot perform " |
218 | "the search.\nPlease enter a search expression\n" | 221 | "the search.\nPlease enter a search expression\n" |
219 | "using the wildcard characters\n '*' and '?'" | 222 | "using the wildcard characters\n '*' and '?'" |
220 | "where needed.")); | 223 | "where needed.")); |
221 | return; | 224 | return; |
222 | } | 225 | } |
223 | 226 | ||
224 | search(re); | 227 | search(re); |
225 | 228 | ||
226 | listView->setStartDate( mStartDate->date() ); | 229 | listView->setStartDate( mStartDate->date() ); |
227 | listView->showEvents(mMatchedEvents); | 230 | listView->showEvents(mMatchedEvents); |
228 | listView->addTodos(mMatchedTodos); | 231 | listView->addTodos(mMatchedTodos); |
229 | listView->addJournals(mMatchedJournals); | 232 | listView->addJournals(mMatchedJournals); |
230 | 233 | ||
231 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 234 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
232 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 235 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
233 | } else { | 236 | } else { |
234 | QString mess; | 237 | QString mess; |
235 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 238 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
236 | setCaption( i18n("KO/Pi Find: ") + mess); | 239 | setCaption( i18n("KO/Pi Find: ") + mess); |
237 | 240 | ||
238 | } | 241 | } |
239 | searchEdit->setFocus(); | 242 | searchEdit->setFocus(); |
240 | } | 243 | } |
241 | void SearchDialog::updateConfig() | 244 | void SearchDialog::updateConfig() |
242 | { | 245 | { |
243 | listView->updateConfig(); | 246 | listView->updateConfig(); |
244 | } | 247 | } |
245 | void SearchDialog::updateView() | 248 | void SearchDialog::updateView() |
246 | { | 249 | { |
247 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | 250 | //qDebug("SearchDialog::updateView() %d ", isVisible()); |
248 | QRegExp re; | 251 | QRegExp re; |
249 | re.setWildcard(true); // most people understand these better. | 252 | re.setWildcard(true); // most people understand these better. |
250 | re.setCaseSensitive(false); | 253 | re.setCaseSensitive(false); |
251 | re.setPattern(searchEdit->text()); | 254 | QString st = searchEdit->text(); |
255 | if ( st.right(1) != "*") | ||
256 | st += "*"; | ||
257 | re.setPattern(st); | ||
252 | if (re.isValid()) { | 258 | if (re.isValid()) { |
253 | search(re); | 259 | search(re); |
254 | } else { | 260 | } else { |
255 | mMatchedEvents.clear(); | 261 | mMatchedEvents.clear(); |
256 | mMatchedTodos.clear(); | 262 | mMatchedTodos.clear(); |
257 | mMatchedJournals.clear(); | 263 | mMatchedJournals.clear(); |
258 | } | 264 | } |
259 | listView->setStartDate( mStartDate->date() ); | 265 | listView->setStartDate( mStartDate->date() ); |
260 | listView->showEvents(mMatchedEvents); | 266 | listView->showEvents(mMatchedEvents); |
261 | listView->addTodos(mMatchedTodos); | 267 | listView->addTodos(mMatchedTodos); |
262 | listView->addJournals(mMatchedJournals); | 268 | listView->addJournals(mMatchedJournals); |
263 | } | 269 | } |
264 | 270 | ||
265 | void SearchDialog::search(const QRegExp &re) | 271 | void SearchDialog::search(const QRegExp &re) |
266 | { | 272 | { |
267 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 273 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
268 | mEndDate->date(), | 274 | mEndDate->date(), |
269 | false /*mInclusiveCheck->isChecked()*/ ); | 275 | false /*mInclusiveCheck->isChecked()*/ ); |
270 | 276 | ||
271 | mMatchedEvents.clear(); | 277 | mMatchedEvents.clear(); |
272 | if ( mSearchEvent->isChecked() ) { | 278 | if ( mSearchEvent->isChecked() ) { |
273 | Event *ev; | 279 | Event *ev; |
274 | for(ev=events.first();ev;ev=events.next()) { | 280 | for(ev=events.first();ev;ev=events.next()) { |
275 | if (mSummaryCheck->isChecked()) { | 281 | if (mSummaryCheck->isChecked()) { |
276 | #if QT_VERSION >= 0x030000 | 282 | #if QT_VERSION >= 0x030000 |
277 | if (re.search(ev->summary()) != -1) | 283 | if (re.search(ev->summary()) != -1) |
278 | #else | 284 | #else |
279 | if (re.match(ev->summary()) != -1) | 285 | if (re.match(ev->summary()) != -1) |
280 | #endif | 286 | #endif |
281 | { | 287 | { |
282 | mMatchedEvents.append(ev); | 288 | mMatchedEvents.append(ev); |
283 | continue; | 289 | continue; |
284 | } | 290 | } |
285 | #if QT_VERSION >= 0x030000 | 291 | #if QT_VERSION >= 0x030000 |
286 | if (re.search(ev->location()) != -1) | 292 | if (re.search(ev->location()) != -1) |
287 | #else | 293 | #else |
288 | if (re.match(ev->location()) != -1) | 294 | if (re.match(ev->location()) != -1) |
289 | #endif | 295 | #endif |
290 | { | 296 | { |
291 | mMatchedEvents.append(ev); | 297 | mMatchedEvents.append(ev); |
292 | continue; | 298 | continue; |
293 | } | 299 | } |
294 | } | 300 | } |
295 | if (mDescriptionCheck->isChecked()) { | 301 | if (mDescriptionCheck->isChecked()) { |
296 | #if QT_VERSION >= 0x030000 | 302 | #if QT_VERSION >= 0x030000 |
297 | if (re.search(ev->description()) != -1) | 303 | if (re.search(ev->description()) != -1) |
298 | #else | 304 | #else |
299 | if (re.match(ev->description()) != -1) | 305 | if (re.match(ev->description()) != -1) |