-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 8 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 95 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 14 |
3 files changed, 67 insertions, 50 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 350d6b1..9c22730 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -354,25 +354,25 @@ { "Show events that recur daily in date nav.","Zeige tägl.wiederh.Term.in Datums Nav." }, { "Show Event...","Zeige Termin..." }, { "Show ev. that recur weekly in date nav.","Zeige wöch.wiederh.Term.in Datums Nav." }, { "Show Marcus Bains line","Zeige Marcus Bains Linie" }, { "Show summary after syncing","Zeige Zusammenfassung nach Sync." }, { "Show time as:","Zeige Zeit als" }, { "Show Todo...","Zeige To-Do" }, { "Vertical screen layout(Needs restart)","Vertikaler Bildschirm-Layout (Neustart!)" }, { "&Show","Zeige" }, { "Show...","Zeige..." }, { "Show","Zeige" }, { "Small","Klein" }, -{ "Sorry","Entschuldigung" }, +{ "Sorry","Tut mir leid" }, {"Sorry, the copy command failed!\nCommand was:\n","Der Kopierbefehl schlug fehl!\nBefehl war:\n"}, { "Start:","Start:" }, { "Start Date","Start Datum" }, { "Start date: %1","Start Datum: %1" }, { "Start Time","Start Zeit" }, { "Status:","Status:" }, { "Status","Status:" }, { "Summaries","Titel" }, { "Summary:","Titel:" }, { "Summary","Titel" }, { "Sunday","Sonntag" }, { "Sun","So" }, @@ -1476,22 +1476,22 @@ { "Pending Suspend Alarm","Laufender Suspend Alarm" }, { "Error loading calendar %1","Fehler beim Laden von Kalender %1" }, { "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" }, { "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" }, { "Alarm Options","Alarm Einstellungen" }, { "Delete selected...","Lösche Ausgewählte..." }, { "None","Nichts" }, { "Selection","Auswahl" }, { "Set categories","Setze Kategorien" }, { "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" }, { "Reset","Neu setzen" }, { "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" }, -{ "","" }, -{ "","" }, -{ "","" }, +{ "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" }, +{ "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" }, +{ "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" },
\ No newline at end of file diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 20118aa..1335d7e 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -123,95 +123,103 @@ KOCalEditView::KOCalEditView(QWidget* parent, KOCalEditView::~KOCalEditView() { // no need to delete child widgets, Qt does it all for us } void KOCalEditView::selectCal(int id ,bool b) { KOPrefs::instance()->getCalendar( id )->isEnabled = b; emit calendarEnabled ( id, b ); emit needsUpdate(); } -void KOCalEditView::selectStdCal( int id, bool b ) +void KOCalEditView::selectStdCal( int id ) { - - if ( !b ) { - KOCalCheckButton* it = (KOCalCheckButton*) sender(); - if ( it ) { - it->blockSignals( true ); - it->setChecked( true ); - it->blockSignals( false ); - return; - } - return; - } - KOCalRadioButton* sen = (KOCalRadioButton*) sender(); KOCalRadioButton* it = mStdandardB.first(); while ( it ) { - if ( it->isChecked() ) { - if ( it != sen ) { - it->blockSignals( true ); - it->setChecked( false ); - it->blockSignals( false ); - break; - } - } + it->blockSignals( true ); + it->setChecked( it->num() == id ); + it->blockSignals( false ); it = mStdandardB.next(); } KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { - kkf->isStandard = false; + kkf->isStandard = (kkf->mCalNumber == id ); kkf = KOPrefs::instance()->mCalendars.next(); } - KOPrefs::instance()->getCalendar( id )->isStandard = true; emit setCalendarDefault ( id ); } void KOCalEditView::selectCalAlarm(int id ,bool b ) { KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; emit alarmEnabled ( id , b ); emit needsUpdate(); } void KOCalEditView::selectReadOnly(int id ,bool b ) { KOPrefs::instance()->getCalendar( id )->isReadOnly = b; emit calendarReadonly ( id , b ); - if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { - KOPrefs::instance()->getCalendar( id )->isStandard = false; - KOPrefs::instance()->getCalendar( 1 )->isStandard = true; - mStdandardB.at(0)->setChecked( true ); - mStdandardB.at(id-1)->setChecked( false ); - emit setCalendarDefault ( 1 ); + if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) { + findNewStandard(); + } else { + if ( !b ){ + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + while ( kkf ) { + if (kkf->isReadOnly && kkf->isStandard ) { + selectStdCal( id ); + break; + } + kkf = KOPrefs::instance()->mCalendars.next(); + } + } } mStdandardB.at(id-1)->setEnabled( !b ); emit needsUpdate(); } +void KOCalEditView::findNewStandard() +{ + bool found = false; + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + while ( kkf ) { + if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) { + found = true; + selectStdCal( kkf->mCalNumber ); + break; + } + kkf = KOPrefs::instance()->mCalendars.next(); + } + if ( !found ) { + KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"), + i18n("Houston, we have a problem!") ); + + } +} + void KOCalEditView::setColor( const QColor& c, int id ) { KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; emit needsUpdate(); } void KOCalEditView::deleteCal( int id ) { KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); QString name = kkf->mName; QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); 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; - if ( kkf->isStandard ) - selectStdCal( 1, true ); + bool findnewstd = kkf->isStandard; emit removeCalendar ( id ); KOPrefs::instance()->mCalendars.remove ( kkf ); + if ( findnewstd ) findNewStandard(); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); } void KOCalEditView::infoCal( int id ) { QString name = KOPrefs::instance()->getCalendar( id )->mName; QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 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) ) ) { emit calendarAdded( id ); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); @@ -275,50 +283,53 @@ void KOCalEditView::readConfig() addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("plus")); connect(addBut,SIGNAL(clicked()),SLOT(addCal())); lab = new QLabel ( " ", mw ); mainLayout->addWidget( lab,0,++ii ); KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); int row = 1; + bool errorLoadStandard = false; while ( kkf ) { int iii = 0; KOCalRadioButton* rb = new KOCalRadioButton( mw ); mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); rb->setChecked( kkf->isStandard ); + if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) + errorLoadStandard = true; rb->setNum( kkf->mCalNumber ); - connect (rb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); + connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); if ( kkf->mErrorOnLoad || kkf->isReadOnly ) rb->setEnabled( false ); KOCalCheckButton* cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); - cb->setChecked( kkf->isEnabled ); + cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad ); cb->setNum( kkf->mCalNumber ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); KOCalButton* name = new KOCalButton( mw ); name->setNum( kkf->mCalNumber ); name->setText( kkf->mName ); mainLayout->addWidget( name,row,++iii ); connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); //lab = new QLabel (" ", mw ); //mainLayout->addWidget( lab,row,++iii ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); - cb->setChecked( kkf->isAlarmEnabled ); + cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); cb->setChecked( kkf->isReadOnly ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); if ( row > 1) { @@ -329,31 +340,32 @@ void KOCalEditView::readConfig() connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); KOCalButton* calb = new KOCalButton( mw ); mainLayout->addWidget( calb,row,++iii ); calb->setNum( kkf->mCalNumber ); calb->setPixmap ( SmallIcon("minus")); connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); int hei = calb->sizeHint().height(); //calb->setMaximumSize( hei*9/10, hei*9/10 ); } ++row; kkf = KOPrefs::instance()->mCalendars.next(); } + if ( errorLoadStandard ) + findNewStandard(); lab = new QLabel ( "", mw ); mainLayout->addWidget( lab,row,0 ); mw->show(); } - void KOCalEditView::defaultInfo() { KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); } void KOCalEditView::addCal() { bool tryagain = true; QString name, file; while ( tryagain ) { KONewCalPrefs prefs ( this ); prefs.nameE->setText( name ); prefs.url->setURL( file ); @@ -422,35 +434,36 @@ int KOCalEditView::getBirtdayID() } void KOCalEditView::enableAll() { toggleList( mEnabledB ); } void KOCalEditView::enableAlarm() { toggleList( mAlarmB ); } void KOCalEditView::disableRO() { - toggleList( mROB ); + toggleList( mROB, false ); } -void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) +void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable ) { - bool dis = false; + bool dis = !enable; KOCalCheckButton* it = list.first(); while ( it ) { - if ( !it->isChecked() ) { - dis = true; + if ( !it->isChecked() == enable && it->isEnabled() ) { + dis = !dis; break; } it = list.next(); } it = list.first(); while ( it ) { - it->setChecked(dis); + if ( it->isEnabled() ) + it->setChecked(dis); it = list.next(); } } void KOCalEditView::deleteAll() { qDebug("delteAll"); } diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 02107cf..874fc6a 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -61,25 +61,27 @@ class KONewCalPrefs : public QDialog nameE = new KLineEdit( this ); lay->addWidget( nameE ); lab = new QLabel( i18n("<b>Local ical (*.ics) file:</b>"), this ); lay->addWidget( lab ); url = new KURLRequester ( this ); lay->addWidget( url ); QPushButton * ok = new QPushButton( i18n("OK"), this ); lay->addWidget( ok ); QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); - setMinimumWidth( 220 ); + int minwid = 220; + if ( QApplication::desktop()->width() >= 320 ) minwid = 300; + setMinimumWidth( minwid ); resize(sizeHint() ); } QString calName() { return nameE->text(); } QString calFileName() { return url->url(); } public slots: void checkValid() { if ( nameE->text().isEmpty() ) { KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); return; @@ -154,36 +156,37 @@ class KOCalRadioButton : public QRadioButton Q_OBJECT public: KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : QRadioButton( parent, name) { connect( this, SIGNAL( toggled ( bool ) ), SLOT( bottonClicked( bool ) )); mNumber = -1; setFocusPolicy(NoFocus); //setMaximumWidth( 10 ); } + int num() { return mNumber;} void setNum ( int num ) {mNumber = num; } signals: - void selectNum ( int, bool ); + void selectNum ( int ); private: int mNumber; void keyPressEvent ( QKeyEvent * e ) { e->ignore(); } private slots : - void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } + void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); } }; class KOFilterView : public KOFilterView_base { Q_OBJECT public: KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); ~KOFilterView(); void updateFilters(); @@ -207,44 +210,45 @@ class KOCalEditView : public QScrollView Q_OBJECT public: KOCalEditView( QWidget* parent=0,const char* name=0); ~KOCalEditView(); int addCalendar( QString calName, QString fileName, bool ask = true ); int getBirtdayID(); public slots: void addCal(); void enableAll(); void enableAlarm(); void disableRO(); void deleteAll(); - void selectStdCal(int,bool ); + void selectStdCal(int); void selectCal(int,bool ); void selectCalAlarm(int,bool ); void selectReadOnly(int,bool ); void setColor(const QColor &,int) ; void deleteCal(int) ; void infoCal(int) ; void readConfig(); void defaultInfo(); + void findNewStandard(); signals: void alarmEnabled ( int cal, bool enable ); void calendarEnabled ( int cal, bool enable ); void calendarReadonly ( int cal, bool readonly ); void setCalendarDefault ( int cal ); void removeCalendar ( int cal ); void calendarAdded( int ); void needsUpdate(); void checkCalendar(); private: QWidget *mw; - void toggleList ( QPtrList<KOCalCheckButton> ); + void toggleList ( QPtrList<KOCalCheckButton> , bool b = true ); QPtrList<KOCalRadioButton> mStdandardB; QPtrList<KOCalCheckButton> mEnabledB; QPtrList<KOCalCheckButton> mAlarmB; QPtrList<KOCalCheckButton> mROB; QGridLayout* mainLayout; }; #endif // KOFILTERVIEW_H |