mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
b6449ca566
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
110 lines
3.7 KiB
Diff
110 lines
3.7 KiB
Diff
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&a=commitdiff&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})
|
|
|