summaryrefslogtreecommitdiffabout
path: root/korganizer/ktimeedit.cpp
Unidiff
Diffstat (limited to 'korganizer/ktimeedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/ktimeedit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index 5222ac9..61a0931 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -28,51 +28,53 @@
28#include <qlistbox.h> 28#include <qlistbox.h>
29#include <qapplication.h> 29#include <qapplication.h>
30 30
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kdebug.h> 33#include <kdebug.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kpimglobalprefs.h> 35#include <kpimglobalprefs.h>
36 36
37#include "ktimeedit.h" 37#include "ktimeedit.h"
38#include "koprefs.h" 38#include "koprefs.h"
39#include <qvalidator.h> 39#include <qvalidator.h>
40 40
41// Validator for a time value with only hours and minutes (no seconds) 41// Validator for a time value with only hours and minutes (no seconds)
42// Mostly locale aware. Author: David Faure <faure@kde.org> 42// Mostly locale aware. Author: David Faure <faure@kde.org>
43 43
44// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. 44// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
45// Difficult to get all in one... 45// Difficult to get all in one...
46// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. 46// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help.
47KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) 47KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
48 : QComboBox(TRUE, parent, name) 48 : QComboBox(TRUE, parent, name)
49{ 49{
50 setInsertionPolicy(NoInsertion); 50 setInsertionPolicy(NoInsertion);
51 mFlagKeyPressed = false; 51 mFlagKeyPressed = false;
52 52 if ( QApplication::desktop()->height() <= 480 ) {
53 if ( QApplication::desktop()->width() < 650 )
54 setSizeLimit ( 6 ); 53 setSizeLimit ( 6 );
54 } else {
55 setSizeLimit ( 12 );
56 }
55 mTime = qt; 57 mTime = qt;
56 58
57// mNoTimeString = i18n("No Time"); 59// mNoTimeString = i18n("No Time");
58// insertItem( mNoTimeString ); 60// insertItem( mNoTimeString );
59 61
60 // Fill combo box with selection of times in localized format. 62 // Fill combo box with selection of times in localized format.
61 QTime timeEntry(0,0,0); 63 QTime timeEntry(0,0,0);
62 do { 64 do {
63 insertItem(KGlobal::locale()->formatTime(timeEntry)); 65 insertItem(KGlobal::locale()->formatTime(timeEntry));
64 timeEntry = timeEntry.addSecs(60*15); 66 timeEntry = timeEntry.addSecs(60*15);
65 } while (!timeEntry.isNull()); 67 } while (!timeEntry.isNull());
66 // Add end of day. 68 // Add end of day.
67 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); 69 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
68 70
69 updateText(); 71 updateText();
70 setFocusPolicy(QWidget::StrongFocus); 72 setFocusPolicy(QWidget::StrongFocus);
71 73
72 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); 74 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
73 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); 75 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
74 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); 76 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText()));
75 QFontMetrics fm ( font() ); 77 QFontMetrics fm ( font() );
76 QString timeString = "24:00"; 78 QString timeString = "24:00";
77 if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) 79 if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 )
78 timeString = "02:00pm"; 80 timeString = "02:00pm";