From ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb Mon Sep 17 00:00:00 2001 From: hakan Date: Tue, 07 May 2002 15:27:34 +0000 Subject: Added separate note editor dialog (currently only a QMultiLineEdit) --- (limited to 'core') diff --git a/core/pim/datebook/.cvsignore b/core/pim/datebook/.cvsignore index d2e4975..74ec374 100644 --- a/core/pim/datebook/.cvsignore +++ b/core/pim/datebook/.cvsignore @@ -14,3 +14,5 @@ datebookweeklstdayhdr.cpp datebookweeklstdayhdr.h datebookweeklstheader.cpp datebookweeklstheader.h +noteentry.cpp +noteentry.h diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index 9383053..60c2b08 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro @@ -11,7 +11,8 @@ HEADERS = datebookday.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ repeatentry.h \ - timepicker.h + timepicker.h \ + noteentryimpl.h SOURCES = main.cpp \ datebookday.cpp \ @@ -23,7 +24,8 @@ SOURCES = main.cpp \ datebookweeklst.cpp \ datebookweekheaderimpl.cpp \ repeatentry.cpp \ - timepicker.cpp + timepicker.cpp \ + noteentryimpl.cpp INTERFACES = dateentry.ui \ datebookdayheader.ui \ @@ -31,7 +33,8 @@ INTERFACES = dateentry.ui \ datebookweekheader.ui \ datebookweeklstheader.ui \ datebookweeklstdayhdr.ui \ - repeatentrybase.ui + repeatentrybase.ui \ + noteentry.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui index 1a712ec..fadbc35 100644 --- a/core/pim/datebook/dateentry.ui +++ b/core/pim/datebook/dateentry.ui @@ -489,13 +489,24 @@ text No Repeat... + + sizePolicy + + 7 + 0 + + - QMultiLineEdit + QToolButton name editNote + + text + Note... + diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index c4f6c68..9cc5073 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp @@ -128,8 +128,8 @@ DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, addOrPick( comboLocation, event.location() ); checkAlarm->setChecked( event.hasAlarm() ); checkAllDay->setChecked( event.type() == Event::AllDay ); - if(!event.notes().isEmpty()) - editNote->setText(event.notes()); + if(!event.notes().isEmpty()) noteStr=event.notes(); + else noteStr=""; spinAlarm->setValue(event.alarmTime()); if ( event.alarmSound() != Event::Silent ) comboSound->setCurrentItem( 1 ); @@ -210,6 +210,9 @@ void DateEntry::init() this, SLOT( slotChangeClock( bool ) ) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotChangeStartOfWeek(bool)) ); + + connect( editNote, SIGNAL(clicked()), + this, SLOT(slotEditNote()) ); QPopupMenu *m2 = new QPopupMenu( this ); endPicker = new DateBookMonth( m2, 0, TRUE ); @@ -220,7 +223,6 @@ void DateEntry::init() connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), this, SLOT( startTimePicked(const QTime &) )); - editNote->setFixedVisibleLines(3); // install eventFilters comboEnd->installEventFilter( this ); comboStart->installEventFilter( this ); @@ -238,6 +240,22 @@ DateEntry::~DateEntry() /* * public slot */ + +void DateEntry::slotEditNote() { + QString s; + s.sprintf("%d/%d ", startDate.day(), startDate.month()); + NoteEntry noteDlg(s+comboDescription->currentText(), noteStr, + this,0,TRUE); + +#if defined(Q_WS_QWS) || defined(_WS_QWS_) + noteDlg.showMaximized(); +#endif + if (noteDlg.exec() ) { + noteStr=noteDlg.note->text(); + } + +} + void DateEntry::endDateChanged( int y, int m, int d ) { endDate.setYMD( y, m, d ); @@ -455,7 +473,7 @@ Event DateEntry::event() ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); if ( rp.type != Event::NoRepeat ) ev.setRepeat( TRUE, rp ); - ev.setNotes( editNote->text() ); + ev.setNotes( noteStr ); //cout << "Start: " << comboStart->currentText() << endl; diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h index 4eb24b4..a3c4668 100644 --- a/core/pim/datebook/dateentryimpl.h +++ b/core/pim/datebook/dateentryimpl.h @@ -21,6 +21,7 @@ #define DATEENTRY_H #include "dateentry.h" +#include "noteentryimpl.h" #include @@ -55,6 +56,7 @@ public slots: void slotRepeat(); void slotChangeClock( bool ); void slotChangeStartOfWeek( bool ); + void slotEditNote(); private: void init(); @@ -70,6 +72,8 @@ private: bool ampm:1; bool startWeekOnMonday:1; bool m_showStart:1; + + QString noteStr; }; #endif // DATEENTRY_H diff --git a/core/pim/datebook/noteentry.ui b/core/pim/datebook/noteentry.ui new file mode 100644 index 0000000..ce3c4ad --- a/dev/null +++ b/core/pim/datebook/noteentry.ui @@ -0,0 +1,68 @@ + +NoteEntryBase + + QDialog + + name + NoteEntryBase + + + geometry + + 0 + 0 + 465 + 500 + + + + caption + Edit Note + + + layoutMargin + + + layoutSpacing + + + + margin + 2 + + + spacing + 0 + + + QLabel + + name + eventLabel + + + text + <b>1/10</b> Lunch + + + alignment + AlignCenter + + + hAlign + + + + QMultiLineEdit + + name + note + + + wordWrap + WidgetWidth + + + + + diff --git a/core/pim/datebook/noteentryimpl.cpp b/core/pim/datebook/noteentryimpl.cpp new file mode 100644 index 0000000..9e1abb9 --- a/dev/null +++ b/core/pim/datebook/noteentryimpl.cpp @@ -0,0 +1,16 @@ +#include "noteentryimpl.h" +#include "qstring.h" +#include "qmultilinedit.h" +#include "qlabel.h" + +NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, + QWidget* parent, const char* name, bool modal, + WFlags fl) : + NoteEntryBase(parent, name, modal, fl) { + + + eventLabel->setText(title); + note->setText(noteStr); + int l=note->length(); + note->setCursorPosition(l,l,false); +} diff --git a/core/pim/datebook/noteentryimpl.h b/core/pim/datebook/noteentryimpl.h new file mode 100644 index 0000000..f3adfa6 --- a/dev/null +++ b/core/pim/datebook/noteentryimpl.h @@ -0,0 +1,18 @@ +#ifndef noteentryimpl_h +#define noteentryimpl_h + +#include "noteentry.h" + +class QString; + +class NoteEntry : public NoteEntryBase +{ + Q_OBJECT + +public: + NoteEntry(const QString &title, const QString ¬eStr, + QWidget* parent = 0, const char* name = 0, + bool modal=TRUE, WFlags fl=0); +}; + +#endif -- cgit v0.9.0.2