summaryrefslogtreecommitdiffabout
path: root/korganizer/journalentry.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/journalentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 739949d..5fc3f2f 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -32,129 +32,130 @@
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <ktextedit.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include "koprefs.h"
#include <klineedit.h>
#include <kdialog.h>
#include "kolocationbox.h"
#include <libkcal/journal.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include "journalentry.h"
//#include "journalentry.moc"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
QFrame(parent)
{
int fac = 5;
heiHint = QApplication::desktop()->height();
if ( heiHint > 800 )
fac += 2;
heiHint = heiHint / fac;
showOnlyMode = false;
mCalendar = calendar;
mJournal = 0;
visibleMode = true;
QHBox * vb = new QHBox ( this );
QPixmap iconp;
vb->setMargin ( KDialog::marginHint()-1 );
QPushButton * toggleJournal = new QPushButton( vb );
iconp = SmallIcon("1updownarrow");
toggleJournal->setPixmap (iconp ) ;
QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb);
- vb->setStretchFactor (textLabel,1);
- vb->setStretchFactor( toggleJournal, 1 );
mTitle = new KOLocationBox(TRUE, vb, 30);
mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
mCalendarBox = new QComboBox(vb);
mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
#ifndef DESKTOP_VERSION
mTitle->setSizeLimit( 8 );
mCalendarBox->setSizeLimit( 8 );
#endif
vb->setStretchFactor ( mTitle, 8 );
int limit = 3;
if ( QApplication::desktop()->width() < 640 )
limit = 6;
vb->setStretchFactor ( mCalendarBox, limit );
//mTitleLabel->setMargin(0);
//mTitleLabel->setAlignment(AlignCenter);
QPushButton * loadTemplate = new QPushButton( vb );
QPushButton * saveTemplate = new QPushButton( vb );
if ( QApplication::desktop()->width() < 321 )
iconp = SmallIcon("fileexport16");
else
iconp = SmallIcon("fileexport");
saveTemplate->setPixmap (iconp ) ;
int size = saveTemplate->sizeHint().height();
if ( QApplication::desktop()->width() < 321 )
iconp = SmallIcon("fileimport16");
else
iconp = SmallIcon("fileimport");
loadTemplate->setPixmap (iconp ) ;
loadTemplate->setFixedSize( size, size );
saveTemplate->setFixedSize( size, size );
- toggleJournal->setFixedSize( size , size );
+ int widwid = size;
+ if ( QApplication::desktop()->width() < 320 )
+ widwid = size/2+1;
+ toggleJournal->setFixedSize( widwid , size );
mTitle->setFixedHeight( size+4);
mCalendarBox->setFixedHeight( size+4);
mEditor = new KTextEdit(this);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
#endif
mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width();
mDeskWid = QApplication::desktop()->width();
int maxwid = mDeskWid - mMaxWidDiff;
if ( QApplication::desktop()->width() < 640 ) {
mTitle->setMaximumWidth( maxwid/2 +20 );
mCalendarBox->setMaximumWidth( maxwid/2 -20);
} else {
mTitle->setMaximumWidth( (maxwid/4)*3);
mCalendarBox->setMaximumWidth( maxwid/2 );
}
//mCalendarBox->setMaximumWidth( maxwid/2 -20 );
mEditor->setWordWrap( KTextEdit::WidgetWidth );
QBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->addWidget(vb);
topLayout->addWidget(mEditor);
mEditor->installEventFilter(this);
connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
mTitle->load( KOLocationBox::SUMMARYJOURNAL );
mTitle->lineEdit ()->setText("");
}
JournalEntry::~JournalEntry()
{
//qDebug("JournalEntry::~JournalEntry() ");
}
void JournalEntry::resizeEvent(QResizeEvent* e )
{
#ifndef DESKTOP_VERSION
if ( mDeskWid != QApplication::desktop()->width() ) {
mDeskWid == QApplication::desktop()->width();
int maxwid = mDeskWid - mMaxWidDiff;
if ( QApplication::desktop()->width() < 640 ) {
mTitle->setMaximumWidth( maxwid/2 +20 );
mCalendarBox->setMaximumWidth( maxwid/2 -20);
}
else {
mTitle->setMaximumWidth( (maxwid/4)*3);
mCalendarBox->setMaximumWidth( maxwid/2 );
}