author | hakan <hakan> | 2002-05-07 15:27:34 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-05-07 15:27:34 (UTC) |
commit | ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb (patch) (side-by-side diff) | |
tree | 60d75877abb05a322b265d8b50621f3f7f75c9d1 | |
parent | 8ba0398d93f0e70ea2de254a4090d8bd02f593cd (diff) | |
download | opie-ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb.zip opie-ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb.tar.gz opie-ad2c6f2e1b5504989ceed297d9ee8c49129ad1fb.tar.bz2 |
Added separate note editor dialog (currently only a QMultiLineEdit)
-rw-r--r-- | core/pim/datebook/.cvsignore | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 9 | ||||
-rw-r--r-- | core/pim/datebook/dateentry.ui | 13 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 26 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.h | 4 | ||||
-rw-r--r-- | core/pim/datebook/noteentry.ui | 68 | ||||
-rw-r--r-- | core/pim/datebook/noteentryimpl.cpp | 16 | ||||
-rw-r--r-- | core/pim/datebook/noteentryimpl.h | 18 |
8 files changed, 148 insertions, 8 deletions
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 @@ -9,8 +9,10 @@ datebookweekheader.h datebooksettingsbase.h datebooksettingsbase.cpp repeatentrybase.cpp repeatentrybase.h 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 @@ -6,37 +6,40 @@ HEADERS = datebookday.h \ datebook.h \ dateentryimpl.h \ datebookdayheaderimpl.h \ datebooksettings.h \ datebookweek.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ repeatentry.h \ - timepicker.h + timepicker.h \ + noteentryimpl.h SOURCES = main.cpp \ datebookday.cpp \ datebook.cpp \ dateentryimpl.cpp \ datebookdayheaderimpl.cpp \ datebooksettings.cpp \ datebookweek.cpp \ datebookweeklst.cpp \ datebookweekheaderimpl.cpp \ repeatentry.cpp \ - timepicker.cpp + timepicker.cpp \ + noteentryimpl.cpp INTERFACES = dateentry.ui \ datebookdayheader.ui \ datebooksettingsbase.ui \ datebookweekheader.ui \ datebookweeklstheader.ui \ datebookweeklstdayhdr.ui \ - repeatentrybase.ui + repeatentrybase.ui \ + noteentry.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie TARGET = datebook TRANSLATIONS = ../i18n/pt_BR/datebook.ts 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 @@ -484,23 +484,34 @@ <property stdset="1"> <name>focusPolicy</name> <enum>TabFocus</enum> </property> <property stdset="1"> <name>text</name> <string>No Repeat...</string> </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> </widget> <widget row="10" column="0" rowspan="1" colspan="4" > - <class>QMultiLineEdit</class> + <class>QToolButton</class> <property stdset="1"> <name>name</name> <cstring>editNote</cstring> </property> + <property stdset="1"> + <name>text</name> + <string>Note...</string> + </property> </widget> </grid> </widget> <customwidgets> <customwidget> <class>TimeZoneSelector</class> <header location="global">qpe/tzselect.h</header> <sizehint> 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 @@ -123,18 +123,18 @@ DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, setDates(event.start(),event.end()); comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); if(!event.description().isEmpty()) addOrPick( comboDescription, event.description() ); if(!event.location().isEmpty()) 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 ); if ( event.hasRepeat() ) { rp = event.repeatPattern(); cmdRepeat->setText( tr("Repeat...") ); } setRepeatLabel(); @@ -205,27 +205,29 @@ void DateEntry::init() //Let start button change both start and end dates connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( endDateChanged( int, int, int ) ) ); connect( qApp, SIGNAL( clockChanged( bool ) ), 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 ); m2->insertItem( endPicker ); buttonEnd->setPopup( m2 ); connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( endDateChanged( int, int, int ) ) ); connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), this, SLOT( startTimePicked(const QTime &) )); - editNote->setFixedVisibleLines(3); // install eventFilters comboEnd->installEventFilter( this ); comboStart->installEventFilter( this ); } /* * Destroys the object and frees any allocated resources */ @@ -233,16 +235,32 @@ DateEntry::~DateEntry() { // no need to delete child widgets, Qt does it all for us //cout << "Del: " << comboStart->currentText() << endl; } /* * public slot */ + +void DateEntry::slotEditNote() { + QString s; + s.sprintf("<B>%d/%d</B> ", 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 ); if ( endDate < startDate ) { endDate = startDate; } buttonEnd->setText( TimeString::shortDate( endDate ) ); @@ -450,17 +468,17 @@ Event DateEntry::event() // we only have one type of sound at the moment... LOUD!!! if ( comboSound->currentItem() != 0 ) st = Event::Loud; else st = Event::Silent; 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; return ev; } void DateEntry::setRepeatLabel() { 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 @@ -16,16 +16,17 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef DATEENTRY_H #define DATEENTRY_H #include "dateentry.h" +#include "noteentryimpl.h" #include <qpe/event.h> #include <qdatetime.h> class DateBookMonth; class DateEntry : public DateEntryBase @@ -50,26 +51,29 @@ public slots: void startDateChanged(int, int, int); void startTimeEdited( const QString & ); void startTimeChanged( const QTime & ); void startTimePicked( const QTime & ); void typeChanged( const QString & ); void slotRepeat(); void slotChangeClock( bool ); void slotChangeStartOfWeek( bool ); + void slotEditNote(); private: void init(); void initCombos(); void setDates( const QDateTime& s, const QDateTime& e ); void setRepeatLabel(); void updateTimeEdit(bool,bool); DateBookMonth *startPicker, *endPicker; QDate startDate, endDate; QTime startTime, endTime; Event::RepeatPattern rp; 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 @@ +<!DOCTYPE UI><UI> +<class>NoteEntryBase</class> +<widget> + <class>QDialog</class> + <property stdset="1"> + <name>name</name> + <cstring>NoteEntryBase</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>465</width> + <height>500</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Edit Note</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>2</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>0</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>eventLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string><b>1/10</b> Lunch</string> + </property> + <property stdset="1"> + <name>alignment</name> + <set>AlignCenter</set> + </property> + <property> + <name>hAlign</name> + </property> + </widget> + <widget> + <class>QMultiLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>note</cstring> + </property> + <property stdset="1"> + <name>wordWrap</name> + <enum>WidgetWidth</enum> + </property> + </widget> + </vbox> +</widget> +</UI> 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 |