summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index f0e0f86..739949d 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -71,33 +71,36 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
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 QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); 79 QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb);
80 vb->setStretchFactor (textLabel,1); 80 vb->setStretchFactor (textLabel,1);
81 vb->setStretchFactor( toggleJournal, 1 ); 81 vb->setStretchFactor( toggleJournal, 1 );
82 mTitle = new KOLocationBox(TRUE, vb, 30); 82 mTitle = new KOLocationBox(TRUE, vb, 30);
83 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); 83 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
84 mCalendarBox = new QComboBox(vb); 84 mCalendarBox = new QComboBox(vb);
85 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); 85 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
86#ifndef DESKTOP_VERSION 86#ifndef DESKTOP_VERSION
87 mTitle->setSizeLimit( 8 ); 87 mTitle->setSizeLimit( 8 );
88 mCalendarBox->setSizeLimit( 8 ); 88 mCalendarBox->setSizeLimit( 8 );
89#endif 89#endif
90 vb->setStretchFactor ( mTitle, 8 ); 90 vb->setStretchFactor ( mTitle, 8 );
91 vb->setStretchFactor ( mCalendarBox, 3 ); 91 int limit = 3;
92 if ( QApplication::desktop()->width() < 640 )
93 limit = 6;
94 vb->setStretchFactor ( mCalendarBox, limit );
92 //mTitleLabel->setMargin(0); 95 //mTitleLabel->setMargin(0);
93 //mTitleLabel->setAlignment(AlignCenter); 96 //mTitleLabel->setAlignment(AlignCenter);
94 QPushButton * loadTemplate = new QPushButton( vb ); 97 QPushButton * loadTemplate = new QPushButton( vb );
95 QPushButton * saveTemplate = new QPushButton( vb ); 98 QPushButton * saveTemplate = new QPushButton( vb );
96 if ( QApplication::desktop()->width() < 321 ) 99 if ( QApplication::desktop()->width() < 321 )
97 iconp = SmallIcon("fileexport16"); 100 iconp = SmallIcon("fileexport16");
98 else 101 else
99 iconp = SmallIcon("fileexport"); 102 iconp = SmallIcon("fileexport");
100 saveTemplate->setPixmap (iconp ) ; 103 saveTemplate->setPixmap (iconp ) ;
101 int size = saveTemplate->sizeHint().height(); 104 int size = saveTemplate->sizeHint().height();
102 if ( QApplication::desktop()->width() < 321 ) 105 if ( QApplication::desktop()->width() < 321 )
103 iconp = SmallIcon("fileimport16"); 106 iconp = SmallIcon("fileimport16");
@@ -107,53 +110,67 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
107 loadTemplate->setFixedSize( size, size ); 110 loadTemplate->setFixedSize( size, size );
108 saveTemplate->setFixedSize( size, size ); 111 saveTemplate->setFixedSize( size, size );
109 toggleJournal->setFixedSize( size , size ); 112 toggleJournal->setFixedSize( size , size );
110 mTitle->setFixedHeight( size+4); 113 mTitle->setFixedHeight( size+4);
111 mCalendarBox->setFixedHeight( size+4); 114 mCalendarBox->setFixedHeight( size+4);
112 mEditor = new KTextEdit(this); 115 mEditor = new KTextEdit(this);
113#ifndef DESKTOP_VERSION 116#ifndef DESKTOP_VERSION
114 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 117 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
115#endif 118#endif
116 mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); 119 mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width();
117 mDeskWid = QApplication::desktop()->width(); 120 mDeskWid = QApplication::desktop()->width();
118 int maxwid = mDeskWid - mMaxWidDiff; 121 int maxwid = mDeskWid - mMaxWidDiff;
119 mTitle->setMaximumWidth( maxwid/2 +20 ); 122 if ( QApplication::desktop()->width() < 640 ) {
120 mCalendarBox->setMaximumWidth( maxwid/2 -20 ); 123 mTitle->setMaximumWidth( maxwid/2 +20 );
124 mCalendarBox->setMaximumWidth( maxwid/2 -20);
125 } else {
126 mTitle->setMaximumWidth( (maxwid/4)*3);
127 mCalendarBox->setMaximumWidth( maxwid/2 );
128 }
129 //mCalendarBox->setMaximumWidth( maxwid/2 -20 );
121 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 130 mEditor->setWordWrap( KTextEdit::WidgetWidth );
122 QBoxLayout *topLayout = new QVBoxLayout(this); 131 QBoxLayout *topLayout = new QVBoxLayout(this);
123 topLayout->addWidget(vb); 132 topLayout->addWidget(vb);
124 topLayout->addWidget(mEditor); 133 topLayout->addWidget(mEditor);
125 mEditor->installEventFilter(this); 134 mEditor->installEventFilter(this);
126 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 135 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
127 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 136 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
128 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 137 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
129 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 138 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
130 mTitle->lineEdit ()->setText(""); 139 mTitle->lineEdit ()->setText("");
131} 140}
132 141
133JournalEntry::~JournalEntry() 142JournalEntry::~JournalEntry()
134{ 143{
135 //qDebug("JournalEntry::~JournalEntry() "); 144 //qDebug("JournalEntry::~JournalEntry() ");
136} 145}
137void JournalEntry::resizeEvent(QResizeEvent* e ) 146void JournalEntry::resizeEvent(QResizeEvent* e )
138{ 147{
139#ifndef DESKTOP_VERSION 148#ifndef DESKTOP_VERSION
149
140 if ( mDeskWid != QApplication::desktop()->width() ) { 150 if ( mDeskWid != QApplication::desktop()->width() ) {
141 mDeskWid == QApplication::desktop()->width(); 151 mDeskWid == QApplication::desktop()->width();
142 int maxwid = mDeskWid - mMaxWidDiff; 152 int maxwid = mDeskWid - mMaxWidDiff;
143 mTitle->setMaximumWidth( maxwid/2 +20 ); 153 if ( QApplication::desktop()->width() < 640 ) {
144 mCalendarBox->setMaximumWidth( maxwid/2 -20 ); 154 mTitle->setMaximumWidth( maxwid/2 +20 );
155 mCalendarBox->setMaximumWidth( maxwid/2 -20);
156 }
157 else {
158 mTitle->setMaximumWidth( (maxwid/4)*3);
159 mCalendarBox->setMaximumWidth( maxwid/2 );
160 }
161 //mCalendarBox->setMaximumWidth( maxwid/2 -20 );
145 } 162 }
146 setMaximumWidth( QApplication::desktop()->width() ); 163 //setMaximumWidth( QApplication::desktop()->width() );
147 qDebug("MAXXX %d ", QApplication::desktop()->width()); 164 //qDebug("MAXXX %d ", QApplication::desktop()->width());
148#endif 165#endif
149 QFrame::resizeEvent( e ); 166 QFrame::resizeEvent( e );
150} 167}
151QSize JournalEntry::sizeHint() const 168QSize JournalEntry::sizeHint() const
152{ 169{
153 return QSize ( 240, heiHint ); 170 return QSize ( 240, heiHint );
154} 171}
155void JournalEntry::slotSaveTemplate() 172void JournalEntry::slotSaveTemplate()
156{ 173{
157 QString fileName =locateLocal( "templates", "journals" ); 174 QString fileName =locateLocal( "templates", "journals" );
158 QDir t_dir; 175 QDir t_dir;
159 if ( !t_dir.exists(fileName) ) 176 if ( !t_dir.exists(fileName) )