summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-02-21 13:34:06 (UTC)
committer zautrix <zautrix>2005-02-21 13:34:06 (UTC)
commitce261d6197d319d67f7b275813449f36ce42a730 (patch) (unidiff)
tree6221eef1d00a918127377883eaf76f8162db6772 /libkdepim
parentb4ebc9c227f986369fe9b0193158f3893a29df08 (diff)
downloadkdepimpi-ce261d6197d319d67f7b275813449f36ce42a730.zip
kdepimpi-ce261d6197d319d67f7b275813449f36ce42a730.tar.gz
kdepimpi-ce261d6197d319d67f7b275813449f36ce42a730.tar.bz2
default button fixes
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kdateedit.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index 946fc0d..3d9e690 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -54,64 +54,65 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
54 QPalette palette = QWidget::palette(); 54 QPalette palette = QWidget::palette();
55 unsigned char red, green, blue; 55 unsigned char red, green, blue;
56 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; 56 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
57 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; 57 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
58 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; 58 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
59 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); 59 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
60 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); 60 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
61 mDateEdit->setPalette( palette ); 61 mDateEdit->setPalette( palette );
62 62
63 if ( withoutDP ) { 63 if ( withoutDP ) {
64 mDateFrame = 0; 64 mDateFrame = 0;
65 mDateButton = 0; 65 mDateButton = 0;
66 mDatePicker = 0; 66 mDatePicker = 0;
67 } else { 67 } else {
68 QPixmap pixmap = SmallIcon("smallcal"); 68 QPixmap pixmap = SmallIcon("smallcal");
69 mDateButton = new QPushButton(this); 69 mDateButton = new QPushButton(this);
70 mDateButton->setPixmap(pixmap); 70 mDateButton->setPixmap(pixmap);
71 71
72 mDateFrame = new QVBox(0,0,WType_Popup); 72 mDateFrame = new QVBox(0,0,WType_Popup);
73 // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 73 // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
74 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 74 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
75 mDateFrame->setLineWidth(3); 75 mDateFrame->setLineWidth(3);
76 mDateFrame->hide(); 76 mDateFrame->hide();
77 77
78 mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); 78 mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate());
79 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); 79 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate)));
80 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); 80 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate)));
81 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); 81 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate)));
82 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); 82 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate)));
83 connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); 83 connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide()));
84 connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); 84 connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker()));
85 mDateButton->setFocusPolicy( QWidget::NoFocus ); 85 mDateButton->setFocusPolicy( QWidget::NoFocus );
86 mDateButton->setAutoDefault( false );
86 //mDateFrame->resize( 400, 300 ); 87 //mDateFrame->resize( 400, 300 );
87 88
88 } 89 }
89 connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); 90 connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed()));
90 connect(mDateEdit,SIGNAL(textChanged(const QString &)), 91 connect(mDateEdit,SIGNAL(textChanged(const QString &)),
91 SLOT(textChanged(const QString &))); 92 SLOT(textChanged(const QString &)));
92 93
93 // Create the keyword list. This will be used to match against when the user 94 // Create the keyword list. This will be used to match against when the user
94 // enters information. 95 // enters information.
95 mKeywordMap[i18n("tomorrow")] = 1; 96 mKeywordMap[i18n("tomorrow")] = 1;
96 mKeywordMap[i18n("today")] = 0; 97 mKeywordMap[i18n("today")] = 0;
97 mKeywordMap[i18n("yesterday")] = -1; 98 mKeywordMap[i18n("yesterday")] = -1;
98 99
99 /* 100 /*
100 * This loop uses some math tricks to figure out the offset in days 101 * This loop uses some math tricks to figure out the offset in days
101 * to the next date the given day of the week occurs. There 102 * to the next date the given day of the week occurs. There
102 * are two cases, that the new day is >= the current day, which means 103 * are two cases, that the new day is >= the current day, which means
103 * the new day has not occured yet or that the new day < the current day, 104 * the new day has not occured yet or that the new day < the current day,
104 * which means the new day is already passed (so we need to find the 105 * which means the new day is already passed (so we need to find the
105 * day in the next week). 106 * day in the next week).
106 */ 107 */
107 QString dayName; 108 QString dayName;
108 int currentDay = QDate::currentDate().dayOfWeek(); 109 int currentDay = QDate::currentDate().dayOfWeek();
109 for (int i = 1; i <= 7; ++i) 110 for (int i = 1; i <= 7; ++i)
110 { 111 {
111 dayName = KGlobal::locale()->weekDayName(i).lower(); 112 dayName = KGlobal::locale()->weekDayName(i).lower();
112 if (i >= currentDay) 113 if (i >= currentDay)
113 mKeywordMap[dayName] = i - currentDay; 114 mKeywordMap[dayName] = i - currentDay;
114 else 115 else
115 mKeywordMap[dayName] = 7 - currentDay + i; 116 mKeywordMap[dayName] = 7 - currentDay + i;
116 } 117 }
117 118