-rw-r--r-- | korganizer/journalentry.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index b8a4cf2..f0e0f86 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -67,25 +67,26 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
67 | heiHint = heiHint / fac; | 67 | heiHint = heiHint / fac; |
68 | 68 | ||
69 | showOnlyMode = false; | 69 | showOnlyMode = false; |
70 | mCalendar = calendar; | 70 | mCalendar = calendar; |
71 | mJournal = 0; | 71 | mJournal = 0; |
72 | visibleMode = true; | 72 | visibleMode = true; |
73 | QHBox * vb = new QHBox ( this ); | 73 | QHBox * vb = new QHBox ( this ); |
74 | QPixmap iconp; | 74 | QPixmap iconp; |
75 | vb->setMargin ( KDialog::marginHint()-1 ); | 75 | vb->setMargin ( KDialog::marginHint()-1 ); |
76 | QPushButton * toggleJournal = new QPushButton( vb ); | 76 | QPushButton * toggleJournal = new QPushButton( vb ); |
77 | iconp = SmallIcon("1updownarrow"); | 77 | iconp = SmallIcon("1updownarrow"); |
78 | toggleJournal->setPixmap (iconp ) ; | 78 | toggleJournal->setPixmap (iconp ) ; |
79 | vb->setStretchFactor (new QLabel(" "+i18n("Title: "),vb),1); | 79 | QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); |
80 | vb->setStretchFactor (textLabel,1); | ||
80 | vb->setStretchFactor( toggleJournal, 1 ); | 81 | vb->setStretchFactor( toggleJournal, 1 ); |
81 | mTitle = new KOLocationBox(TRUE, vb, 30); | 82 | mTitle = new KOLocationBox(TRUE, vb, 30); |
82 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 83 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
83 | mCalendarBox = new QComboBox(vb); | 84 | mCalendarBox = new QComboBox(vb); |
84 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 85 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
85 | #ifndef DESKTOP_VERSION | 86 | #ifndef DESKTOP_VERSION |
86 | mTitle->setSizeLimit( 8 ); | 87 | mTitle->setSizeLimit( 8 ); |
87 | mCalendarBox->setSizeLimit( 8 ); | 88 | mCalendarBox->setSizeLimit( 8 ); |
88 | #endif | 89 | #endif |
89 | vb->setStretchFactor ( mTitle, 8 ); | 90 | vb->setStretchFactor ( mTitle, 8 ); |
90 | vb->setStretchFactor ( mCalendarBox, 3 ); | 91 | vb->setStretchFactor ( mCalendarBox, 3 ); |
91 | //mTitleLabel->setMargin(0); | 92 | //mTitleLabel->setMargin(0); |
@@ -103,40 +104,59 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
103 | else | 104 | else |
104 | iconp = SmallIcon("fileimport"); | 105 | iconp = SmallIcon("fileimport"); |
105 | loadTemplate->setPixmap (iconp ) ; | 106 | loadTemplate->setPixmap (iconp ) ; |
106 | loadTemplate->setFixedSize( size, size ); | 107 | loadTemplate->setFixedSize( size, size ); |
107 | saveTemplate->setFixedSize( size, size ); | 108 | saveTemplate->setFixedSize( size, size ); |
108 | toggleJournal->setFixedSize( size , size ); | 109 | toggleJournal->setFixedSize( size , size ); |
109 | mTitle->setFixedHeight( size+4); | 110 | mTitle->setFixedHeight( size+4); |
110 | mCalendarBox->setFixedHeight( size+4); | 111 | mCalendarBox->setFixedHeight( size+4); |
111 | mEditor = new KTextEdit(this); | 112 | mEditor = new KTextEdit(this); |
112 | #ifndef DESKTOP_VERSION | 113 | #ifndef DESKTOP_VERSION |
113 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 114 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
114 | #endif | 115 | #endif |
116 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); | ||
117 | mDeskWid = QApplication::desktop()->width(); | ||
118 | int maxwid = mDeskWid - mMaxWidDiff; | ||
119 | mTitle->setMaximumWidth( maxwid/2 +20 ); | ||
120 | mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | ||
115 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 121 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
116 | QBoxLayout *topLayout = new QVBoxLayout(this); | 122 | QBoxLayout *topLayout = new QVBoxLayout(this); |
117 | topLayout->addWidget(vb); | 123 | topLayout->addWidget(vb); |
118 | topLayout->addWidget(mEditor); | 124 | topLayout->addWidget(mEditor); |
119 | mEditor->installEventFilter(this); | 125 | mEditor->installEventFilter(this); |
120 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 126 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
121 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 127 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
122 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 128 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
123 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 129 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
124 | mTitle->lineEdit ()->setText(""); | 130 | mTitle->lineEdit ()->setText(""); |
125 | } | 131 | } |
126 | 132 | ||
127 | JournalEntry::~JournalEntry() | 133 | JournalEntry::~JournalEntry() |
128 | { | 134 | { |
129 | //qDebug("JournalEntry::~JournalEntry() "); | 135 | //qDebug("JournalEntry::~JournalEntry() "); |
130 | } | 136 | } |
137 | void JournalEntry::resizeEvent(QResizeEvent* e ) | ||
138 | { | ||
139 | #ifndef DESKTOP_VERSION | ||
140 | if ( mDeskWid != QApplication::desktop()->width() ) { | ||
141 | mDeskWid == QApplication::desktop()->width(); | ||
142 | int maxwid = mDeskWid - mMaxWidDiff; | ||
143 | mTitle->setMaximumWidth( maxwid/2 +20 ); | ||
144 | mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | ||
145 | } | ||
146 | setMaximumWidth( QApplication::desktop()->width() ); | ||
147 | qDebug("MAXXX %d ", QApplication::desktop()->width()); | ||
148 | #endif | ||
149 | QFrame::resizeEvent( e ); | ||
150 | } | ||
131 | QSize JournalEntry::sizeHint() const | 151 | QSize JournalEntry::sizeHint() const |
132 | { | 152 | { |
133 | return QSize ( 240, heiHint ); | 153 | return QSize ( 240, heiHint ); |
134 | } | 154 | } |
135 | void JournalEntry::slotSaveTemplate() | 155 | void JournalEntry::slotSaveTemplate() |
136 | { | 156 | { |
137 | QString fileName =locateLocal( "templates", "journals" ); | 157 | QString fileName =locateLocal( "templates", "journals" ); |
138 | QDir t_dir; | 158 | QDir t_dir; |
139 | if ( !t_dir.exists(fileName) ) | 159 | if ( !t_dir.exists(fileName) ) |
140 | t_dir.mkdir ( fileName ); | 160 | t_dir.mkdir ( fileName ); |
141 | fileName += "/journal"; | 161 | fileName += "/journal"; |
142 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 162 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |