-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 18 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 19 | ||||
-rw-r--r-- | microkde/kglobal.cpp | 7 |
5 files changed, 26 insertions, 30 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index eac2f29..d25f632 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -4017,25 +4017,29 @@ void CalendarView::editFilters() | |||
4017 | 4017 | ||
4018 | CalFilter *filter = mFilters.first(); | 4018 | CalFilter *filter = mFilters.first(); |
4019 | while(filter) { | 4019 | while(filter) { |
4020 | kdDebug() << " Filter: " << filter->name() << endl; | 4020 | kdDebug() << " Filter: " << filter->name() << endl; |
4021 | filter = mFilters.next(); | 4021 | filter = mFilters.next(); |
4022 | } | 4022 | } |
4023 | 4023 | ||
4024 | mDialogManager->showFilterEditDialog(&mFilters); | 4024 | mDialogManager->showFilterEditDialog(&mFilters); |
4025 | updateFilter(); | 4025 | updateFilter(); |
4026 | } | 4026 | } |
4027 | void CalendarView::toggleFilter() | 4027 | void CalendarView::toggleFilter() |
4028 | { | 4028 | { |
4029 | showFilter(! mCalEditView->isVisible()); | 4029 | if ( mLeftFrame->isHidden() ) { |
4030 | toggleExpand(); | ||
4031 | showFilter( true ); | ||
4032 | } else | ||
4033 | showFilter(! mCalEditView->isVisible()); | ||
4030 | } | 4034 | } |
4031 | 4035 | ||
4032 | KOFilterView *CalendarView::filterView() | 4036 | KOFilterView *CalendarView::filterView() |
4033 | { | 4037 | { |
4034 | return mFilterView; | 4038 | return mFilterView; |
4035 | } | 4039 | } |
4036 | void CalendarView::selectFilter( int fil ) | 4040 | void CalendarView::selectFilter( int fil ) |
4037 | { | 4041 | { |
4038 | mFilterView->setSelectedFilter( fil ); | 4042 | mFilterView->setSelectedFilter( fil ); |
4039 | } | 4043 | } |
4040 | void CalendarView::showFilter(bool visible) | 4044 | void CalendarView::showFilter(bool visible) |
4041 | { | 4045 | { |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index e4dc751..bb88386 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -186,37 +186,37 @@ void KOCalEditView::selectReadOnly(int id ,bool b ) | |||
186 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 186 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
187 | 187 | ||
188 | } | 188 | } |
189 | void KOCalEditView::setColor( const QColor& c, int id ) | 189 | void KOCalEditView::setColor( const QColor& c, int id ) |
190 | { | 190 | { |
191 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 191 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
192 | emit needsUpdate(); | 192 | emit needsUpdate(); |
193 | } | 193 | } |
194 | void KOCalEditView::deleteCal( int id ) | 194 | void KOCalEditView::deleteCal( int id ) |
195 | { | 195 | { |
196 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 196 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
197 | QString name = kkf->mName; | 197 | QString name = kkf->mName; |
198 | QString file = kkf->mFileName; | 198 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); |
199 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 199 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
200 | if ( kkf->isStandard ) | 200 | if ( kkf->isStandard ) |
201 | selectStdCal( 1, true ); | 201 | selectStdCal( 1, true ); |
202 | emit removeCalendar ( id ); | 202 | emit removeCalendar ( id ); |
203 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 203 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
204 | emit needsUpdate(); | 204 | emit needsUpdate(); |
205 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 205 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
206 | } | 206 | } |
207 | void KOCalEditView::infoCal( int id ) | 207 | void KOCalEditView::infoCal( int id ) |
208 | { | 208 | { |
209 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 209 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
210 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 210 | QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); |
211 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { | 211 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { |
212 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { | 212 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { |
213 | emit calendarAdded( id ); | 213 | emit calendarAdded( id ); |
214 | emit needsUpdate(); | 214 | emit needsUpdate(); |
215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | else | 218 | else |
219 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 219 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
220 | } | 220 | } |
221 | void KOCalEditView::readConfig() | 221 | void KOCalEditView::readConfig() |
222 | { | 222 | { |
@@ -351,25 +351,25 @@ void KOCalEditView::addCal() | |||
351 | name = prefs.calName(); | 351 | name = prefs.calName(); |
352 | file = prefs.calFileName(); | 352 | file = prefs.calFileName(); |
353 | tryagain = false; | 353 | tryagain = false; |
354 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 354 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
355 | while ( kkf ) { | 355 | while ( kkf ) { |
356 | if ( kkf->mName == name ) { | 356 | if ( kkf->mName == name ) { |
357 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); | 357 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); |
358 | name = ""; | 358 | name = ""; |
359 | tryagain = true; | 359 | tryagain = true; |
360 | break; | 360 | break; |
361 | } | 361 | } |
362 | if ( kkf->mFileName == file ) { | 362 | if ( kkf->mFileName == file ) { |
363 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( file) ); | 363 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); |
364 | tryagain = true; | 364 | tryagain = true; |
365 | file = ""; | 365 | file = ""; |
366 | break; | 366 | break; |
367 | } | 367 | } |
368 | kkf = KOPrefs::instance()->mCalendars.next(); | 368 | kkf = KOPrefs::instance()->mCalendars.next(); |
369 | } | 369 | } |
370 | } | 370 | } |
371 | QFileInfo fi ( file ); | 371 | QFileInfo fi ( file ); |
372 | if (!fi.exists() ) { | 372 | if (!fi.exists() ) { |
373 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) | 373 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) |
374 | return; | 374 | return; |
375 | QFile fileIn( file ); | 375 | QFile fileIn( file ); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 13e88ef..926a136 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -87,24 +87,25 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name | |||
87 | sde = new KDateEdit( start ); | 87 | sde = new KDateEdit( start ); |
88 | ste = new KOTimeEdit( start ); | 88 | ste = new KOTimeEdit( start ); |
89 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | 89 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); |
90 | ede = new KDateEdit( end ); | 90 | ede = new KDateEdit( end ); |
91 | ete = new KOTimeEdit(end ); | 91 | ete = new KOTimeEdit(end ); |
92 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | 92 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); |
93 | sde->setDate( mTodo->runStart().date() ); | 93 | sde->setDate( mTodo->runStart().date() ); |
94 | ste->setTime( mTodo->runStart().time() ); | 94 | ste->setTime( mTodo->runStart().time() ); |
95 | ede->setDate( QDate::currentDate()); | 95 | ede->setDate( QDate::currentDate()); |
96 | ete->setTime( QTime::currentTime() ); | 96 | ete->setTime( QTime::currentTime() ); |
97 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 97 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
98 | lay->addWidget( ok ); | 98 | lay->addWidget( ok ); |
99 | ok->setDefault( true ); | ||
99 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | 100 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); |
100 | lay->addWidget( cancel ); | 101 | lay->addWidget( cancel ); |
101 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 102 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
102 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 103 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
103 | ok = new QPushButton( i18n("Stop - do not save"), this ); | 104 | ok = new QPushButton( i18n("Stop - do not save"), this ); |
104 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); | 105 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); |
105 | lay->addWidget( ok ); | 106 | lay->addWidget( ok ); |
106 | if (QApplication::desktop()->width() < 320 ) | 107 | if (QApplication::desktop()->width() < 320 ) |
107 | resize( 240, 200 ); | 108 | resize( 240, 200 ); |
108 | else | 109 | else |
109 | resize( 320, 200 ); | 110 | resize( 320, 200 ); |
110 | 111 | ||
@@ -1193,44 +1194,27 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) | |||
1193 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1194 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1194 | editItem( item ); | 1195 | editItem( item ); |
1195 | else | 1196 | else |
1196 | showItem( item , QPoint(), 0 ); | 1197 | showItem( item , QPoint(), 0 ); |
1197 | } | 1198 | } |
1198 | void KOTodoView::toggleRunningItem() | 1199 | void KOTodoView::toggleRunningItem() |
1199 | { | 1200 | { |
1200 | // qDebug("KOTodoView::toggleRunning() "); | 1201 | // qDebug("KOTodoView::toggleRunning() "); |
1201 | if ( ! mActiveItem ) | 1202 | if ( ! mActiveItem ) |
1202 | return; | 1203 | return; |
1203 | Todo * t = mActiveItem->todo(); | 1204 | Todo * t = mActiveItem->todo(); |
1204 | if ( t->isRunning() ) { | 1205 | if ( t->isRunning() ) { |
1205 | |||
1206 | |||
1207 | KOStopTodoPrefs tp ( t, this ); | 1206 | KOStopTodoPrefs tp ( t, this ); |
1208 | tp.exec(); | 1207 | tp.exec(); |
1209 | |||
1210 | |||
1211 | #if 0 | ||
1212 | int result = KMessageBox::warningYesNoCancel(this, | ||
1213 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); | ||
1214 | if (result == KMessageBox::Cancel) return; | ||
1215 | if ( result == KMessageBox::No ) { | ||
1216 | QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); | ||
1217 | t->setRunningFalse( comment ); | ||
1218 | } else { | ||
1219 | t->setRunning( false ); | ||
1220 | } | ||
1221 | mActiveItem->construct(); | 1208 | mActiveItem->construct(); |
1222 | |||
1223 | |||
1224 | #endif | ||
1225 | } else { | 1209 | } else { |
1226 | int result = KMessageBox::warningContinueCancel(this, | 1210 | int result = KMessageBox::warningContinueCancel(this, |
1227 | i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); | 1211 | i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); |
1228 | if (result != KMessageBox::Continue) return; | 1212 | if (result != KMessageBox::Continue) return; |
1229 | t->setRunning( true ); | 1213 | t->setRunning( true ); |
1230 | mActiveItem->construct(); | 1214 | mActiveItem->construct(); |
1231 | } | 1215 | } |
1232 | } | 1216 | } |
1233 | 1217 | ||
1234 | void KOTodoView::itemClicked(QListViewItem *item) | 1218 | void KOTodoView::itemClicked(QListViewItem *item) |
1235 | { | 1219 | { |
1236 | //qDebug("KOTodoView::itemClicked %d", item); | 1220 | //qDebug("KOTodoView::itemClicked %d", item); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 13e186d..f945383 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -769,52 +769,53 @@ void MainWindow::initActions() | |||
769 | 769 | ||
770 | // *********************** | 770 | // *********************** |
771 | if ( KOPrefs::instance()->mVerticalScreen ) { | 771 | if ( KOPrefs::instance()->mVerticalScreen ) { |
772 | icon = SmallIcon( "1updownarrow" ); | 772 | icon = SmallIcon( "1updownarrow" ); |
773 | } else { | 773 | } else { |
774 | icon = SmallIcon("1leftrightarrow" ); | 774 | icon = SmallIcon("1leftrightarrow" ); |
775 | } | 775 | } |
776 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 776 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
777 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 777 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
778 | FSaction->addTo( viewMenu ); | 778 | FSaction->addTo( viewMenu ); |
779 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 779 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
780 | 780 | ||
781 | icon = loadPixmap( pathString + "navi" ); | 781 | |
782 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | ||
783 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | ||
784 | action->addTo( viewMenu ); | ||
785 | connect( action, SIGNAL( activated() ), | ||
786 | mView, SLOT( toggleDateNavigatorWidget() ) ); | ||
787 | mToggleNav = action ; | ||
788 | icon = loadPixmap( pathString + "filter" ); | 782 | icon = loadPixmap( pathString + "filter" ); |
789 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 783 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
790 | icon = loadPixmap( pathString + "configure" ); | 784 | icon = loadPixmap( pathString + "configure" ); |
791 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 785 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
792 | action->addTo( viewMenu ); | 786 | action->addTo( viewMenu ); |
793 | connect( action, SIGNAL( activated() ), | 787 | connect( action, SIGNAL( activated() ), |
794 | mView, SLOT( toggleFilter() ) ); | 788 | mView, SLOT( toggleFilter() ) ); |
795 | mToggleFilter = action; | 789 | mToggleFilter = action; |
790 | icon = loadPixmap( pathString + "navi" ); | ||
791 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | ||
792 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | ||
793 | action->addTo( viewMenu ); | ||
794 | connect( action, SIGNAL( activated() ), | ||
795 | mView, SLOT( toggleDateNavigatorWidget() ) ); | ||
796 | mToggleNav = action ; | ||
796 | icon = loadPixmap( pathString + "allday" ); | 797 | icon = loadPixmap( pathString + "allday" ); |
797 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 798 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
798 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 799 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
799 | action->addTo( viewMenu ); | 800 | action->addTo( viewMenu ); |
800 | connect( action, SIGNAL( activated() ), | 801 | connect( action, SIGNAL( activated() ), |
801 | mView, SLOT( toggleAllDaySize() ) ); | 802 | mView, SLOT( toggleAllDaySize() ) ); |
802 | mToggleAllday = action; | 803 | mToggleAllday = action; |
803 | 804 | ||
804 | 805 | ||
805 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 806 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
806 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 807 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
807 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 808 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
808 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 809 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
809 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 810 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
810 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 811 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
811 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 812 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
812 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 813 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
813 | 814 | ||
814 | viewMenu->insertSeparator(); | 815 | viewMenu->insertSeparator(); |
815 | icon = loadPixmap( pathString + "picker" ); | 816 | icon = loadPixmap( pathString + "picker" ); |
816 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 817 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
817 | action->addTo( viewMenu ); | 818 | action->addTo( viewMenu ); |
818 | connect( action, SIGNAL( activated() ), | 819 | connect( action, SIGNAL( activated() ), |
819 | mView, SLOT( showDatePicker() ) ); | 820 | mView, SLOT( showDatePicker() ) ); |
820 | action->addTo( iconToolBar ); | 821 | action->addTo( iconToolBar ); |
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index bf7e238..53edd08 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp | |||
@@ -90,24 +90,31 @@ void KGlobal::setAppName( const QString &appName ) | |||
90 | 90 | ||
91 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); | 91 | mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); |
92 | } | 92 | } |
93 | 93 | ||
94 | //US | 94 | //US |
95 | QString KGlobal::getAppName() | 95 | QString KGlobal::getAppName() |
96 | { | 96 | { |
97 | return mAppName; | 97 | return mAppName; |
98 | } | 98 | } |
99 | QString KGlobal::formatMessage ( QString mess, int maxlen ) | 99 | QString KGlobal::formatMessage ( QString mess, int maxlen ) |
100 | { | 100 | { |
101 | //int maxlen = 80; | 101 | //int maxlen = 80; |
102 | if ( maxlen == 0 ) { | ||
103 | maxlen = QApplication::desktop()->width()/10; | ||
104 | if ( maxlen > 32 ) | ||
105 | maxlen = (maxlen * 3) / 4; | ||
106 | if ( maxlen > 100 ) | ||
107 | maxlen = 100; | ||
108 | } | ||
102 | int start = 0; | 109 | int start = 0; |
103 | int end = mess.length(); | 110 | int end = mess.length(); |
104 | QString retVal = ""; | 111 | QString retVal = ""; |
105 | int nl, space; | 112 | int nl, space; |
106 | while ( (end - start) > maxlen ) { | 113 | while ( (end - start) > maxlen ) { |
107 | nl = mess.find( "\n", start ); | 114 | nl = mess.find( "\n", start ); |
108 | if ( nl > 0 && nl < start + maxlen ) { | 115 | if ( nl > 0 && nl < start + maxlen ) { |
109 | nl += 1; | 116 | nl += 1; |
110 | retVal += mess.mid( start, nl - start); | 117 | retVal += mess.mid( start, nl - start); |
111 | start = nl; | 118 | start = nl; |
112 | } else { | 119 | } else { |
113 | space = mess.findRev( " ", start + maxlen ); | 120 | space = mess.findRev( " ", start + maxlen ); |