summaryrefslogtreecommitdiffstats
path: root/office/tellico/tellico-2.3.5.patch
blob: 96e8c64ecb363c2406bd6fcc6a8260aba044f318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
From: Robby Stephenson <robby@periapsis.org>
Date: Fri, 20 Jan 2012 07:45:00 +0000
Subject: For KDE < 4.6, just use the KLineEdit for filtering dates
X-Git-Url: http://quickgit.kde.org/?p=tellico.git&amp;a=commitdiff&amp;h=051f0860594091a95a9c94e19c9847b09fcef395
---
For KDE < 4.6, just use the KLineEdit for filtering dates
---


--- a/src/filterdialog.cpp
+++ b/src/filterdialog.cpp
@@ -42,11 +42,11 @@
 #include <kiconloader.h>
 
 // KDateComboBox was new in KDE 4.7
-// use a local copy if building in an earlier version
+// use a local copy if building in KDE 4.6
 #include <kdeversion.h>
 #if KDE_IS_VERSION(4,7,0)
 #include <kdatecombobox.h>
-#else
+#elif KDE_IS_VERSION(4,6,0)
 #include "../gui/kdatecombobox.h"
 #endif
 
@@ -66,7 +66,7 @@ using Tellico::FilterRuleWidgetLister;
 using Tellico::FilterDialog;
 
 FilterRuleWidget::FilterRuleWidget(Tellico::FilterRule* rule_, QWidget* parent_)
-    : KHBox(parent_), m_editRegExp(0), m_editRegExpDialog(0), m_isDate(false) {
+    : KHBox(parent_), m_ruleDate(0), m_editRegExp(0), m_editRegExpDialog(0), m_isDate(false) {
   initLists();
   initWidget();
 
@@ -102,12 +102,13 @@ void FilterRuleWidget::initWidget() {
   m_valueStack = new QStackedWidget(this);
   m_ruleValue = new KLineEdit(m_valueStack);
   connect(m_ruleValue, SIGNAL(textChanged(const QString&)), SIGNAL(signalModified()));
+  m_valueStack->addWidget(m_ruleValue);
 
+#if KDE_IS_VERSION(4,6,0)
   m_ruleDate = new KDateComboBox(m_valueStack);
   connect(m_ruleDate, SIGNAL(dateChanged(const QDate&)), SIGNAL(signalModified()));
-
-  m_valueStack->addWidget(m_ruleValue);
   m_valueStack->addWidget(m_ruleDate);
+#endif
 
   if(!KServiceTypeTrader::self()->query(QLatin1String("KRegExpEditor/KRegExpEditor")).isEmpty()) {
     m_editRegExp = new KPushButton(i18n("Edit..."), this);
@@ -172,9 +173,15 @@ void FilterRuleWidget::slotRuleFunctionC
 
   // don't show the date picker if we're using regular expressions
   if(m_isDate && data != FilterRule::FuncRegExp && data != FilterRule::FuncNotRegExp) {
+#if KDE_IS_VERSION(4,6,0)
     m_valueStack->setCurrentWidget(m_ruleDate);
-  } else {
+#else
+    // I don't want a translated message but just an unambiguous hint for older versions
+    m_ruleValue->setClickMessage(QLatin1String("2010-12-30"));
+#endif
+} else {
     m_valueStack->setCurrentWidget(m_ruleValue);
+    m_ruleValue->setClickMessage(QString());
   }
 }
 
@@ -195,7 +202,11 @@ void FilterRuleWidget::setRule(const Tel
       m_isDate = true;
       const QDate date = QDate::fromString(rule_->pattern(), Qt::ISODate);
       if(date.isValid()) {
+#if KDE_IS_VERSION(4,6,0)
         m_ruleDate->setDate(date);
+#else
+        m_ruleValue->setText(rule_->pattern());
+#endif
       }
     }
     const int idx = m_ruleField->findText(field ? field->title() : QString());
@@ -218,9 +229,13 @@ Tellico::FilterRule* FilterRuleWidget::r
   }
 
   QString ruleValue;
+#if KDE_IS_VERSION(4,6,0)
   if(m_valueStack->currentWidget() == m_ruleDate) {
     ruleValue = m_ruleDate->date().toString(Qt::ISODate);
   } else {
+#else
+  if(true) {
+#endif
     ruleValue = m_ruleValue->text().trimmed();
   }
 

--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -34,9 +34,9 @@ SET(gui_STAT_SRCS
    )
 
 # The KDateComboBox class was added to KDE in version 4.7
-# If we're building under an earlier version, use a local copy
-IF(${KDE_VERSION} VERSION_LESS "4.6.99")
+# If we're building under KDE 4.6, use a local copy
+IF(${KDE_VERSION} VERSION_LESS "4.6.99" AND ${KDE_VERSION} VERSION_GREATER "4.5.99")
   LIST(APPEND gui_STAT_SRCS kdatecombobox.cpp)
-ENDIF(${KDE_VERSION} VERSION_LESS "4.6.99")
+ENDIF(${KDE_VERSION} VERSION_LESS "4.6.99" AND ${KDE_VERSION} VERSION_GREATER "4.5.99")
 
 KDE4_ADD_LIBRARY(gui STATIC ${gui_STAT_SRCS})