author | zautrix <zautrix> | 2004-06-29 12:52:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-29 12:52:18 (UTC) |
commit | 275e70532bb26ed78ce2d3bebf980dd745368ec2 (patch) (side-by-side diff) | |
tree | c9252a9ec50856c86cc1165007f841c50d5cdc51 | |
parent | 7b2b9f2b05809b9577837551ad864d88b9b355ef (diff) | |
download | kdepimpi-275e70532bb26ed78ce2d3bebf980dd745368ec2.zip kdepimpi-275e70532bb26ed78ce2d3bebf980dd745368ec2.tar.gz kdepimpi-275e70532bb26ed78ce2d3bebf980dd745368ec2.tar.bz2 |
Removed the include moc on KO dir
49 files changed, 12 insertions, 55 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index b82724f..521781e 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp @@ -1,179 +1,178 @@ /* This file is part of the KDE alarm daemon. Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ // $Id$ #include <qhbox.h> #include <qvbox.h> #include <qapp.h> #include <qlabel.h> #include <qlayout.h> #include <qfile.h> #include <qtimer.h> #include <qsound.h> #include <qpushbutton.h> #include <qspinbox.h> #include <stdlib.h> #ifndef _WIN32_ #include <unistd.h> #include <sys/ioctl.h> #endif #include <stdio.h> #include <fcntl.h> #ifndef DESKTOP_VERSION #include <qtopia/alarmserver.h> #include <qpe/resource.h> #include <qtopia/sound.h> #endif #include "alarmdialog.h" -#include "alarmdialog.moc" AlarmDialog::AlarmDialog(QWidget *parent,const char *name) : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) { setCaption( "KO/Pi Alarm!" ); QVBoxLayout* layout = new QVBoxLayout( this); QLabel* l = new QLabel("The following event triggered alarm:",this); layout->addWidget ( l ); l->setAlignment( AlignCenter); mMessage = new QLabel ( " ", this ); int fs = 18; int fs2 = 12; if ( QApplication::desktop()->width() < 480 ) { setMaximumSize(220, 260); fs2 = 10; } else { setMaximumSize(440, 440); } layout->setSpacing( 3 ); layout->setMargin( 3 ); l->setFont( QFont("helvetica",fs2, QFont::Bold) ); mMessage->setFont( QFont("helvetica",fs, QFont::Bold) ); mMessage->setAlignment( AlignCenter); l = new QLabel("Missed Alarms:",this); l->setAlignment( AlignCenter); layout->addWidget ( mMessage ); layout->addWidget ( l ); mMissedAlarms= new QLabel ( "", this ); mMissedAlarms->setAlignment( AlignCenter); playSoundTimer = new QTimer( this ); connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); playSoundTimer->stop(); layout->addWidget ( mMissedAlarms ); QHBox *suspendBox = new QHBox( this ); suspendBox->setSpacing(3); layout->addWidget ( suspendBox ); (void)new QLabel("Suspend duration (minutes):",suspendBox); mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); mSuspendSpin->setValue(7); // default suspend duration QHBox * bbox = new QHBox ( this ); layout->addWidget ( bbox ); bbox->layout()->setSpacing( 5 ); QPushButton* suspend = new QPushButton( "Suspend", bbox); QPushButton* silen = new QPushButton( " Stop sound ", bbox); QPushButton* okbut = new QPushButton( "Ok", bbox); connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); #ifndef _WIN32_ if ( QFile::exists ( "/dev/sharp_led" ) ) fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); else #endif fd_led = 0; statusLED.which = SHARP_LED_SALARM; mSilent = false; mSuspendCounter = 0; setServerNotification( true ); } void AlarmDialog::reject () { QTimer::singleShot ( 3000, this, SLOT (suspend()) ); slotSuspend(); } AlarmDialog::~AlarmDialog() { } void AlarmDialog::silent () { mSilent = true; } void AlarmDialog::accept() { slotOk(); } void AlarmDialog::suspend() { #ifdef DESKTOP_VERSION #else Sound::soundAlarm (); #endif } void AlarmDialog::slotOk() { mStopAlarm = true; mMissedAlarms->setText(""); mMessage->setText(""); #ifndef _WIN32_ if ( fd_led > 0 ) { statusLED.status = LED_SALARM_OFF ; ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); } #endif QDialog::accept(); } void AlarmDialog::slotSuspend() { //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); mStopAlarm = true; QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); QString mess = "suspend_alarm" +mFileName+"+++" ; if ( mMessage->text().left( 10 ) !="Suspended:" ) mess += "Suspended:\n"; mess +=mMessage->text(); #ifndef DESKTOP_VERSION if ( mServerNotification ) AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); #endif emit addAlarm( nextA , mess ); slotOk(); } void AlarmDialog::setServerNotification( bool b ) { mServerNotification = b; } int AlarmDialog::getSuspendTime( ) { return mSuspendSpin->value(); diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7ac5b11..0956c78 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3346,131 +3346,131 @@ void CalendarView::editIncidenceDescription() } void CalendarView::editIncidence() { // qDebug("editIncidence() "); Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { EditIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::deleteIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { deleteIncidence(incidence); } } void CalendarView::showIncidence(Incidence *incidence) { if ( incidence ) { ShowIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::editIncidence(Incidence *incidence) { if ( incidence ) { EditIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::deleteIncidence(Incidence *incidence) { //qDebug(" CalendarView::deleteIncidence "); if ( incidence ) { DeleteIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::lookForOutgoingMessages() { OutgoingDialog *ogd = mDialogManager->outgoingDialog(); ogd->loadMessages(); } void CalendarView::lookForIncomingMessages() { IncomingDialog *icd = mDialogManager->incomingDialog(); icd->retrieve(); } bool CalendarView::removeCompletedSubTodos( Todo* t ) { bool deleteTodo = true; QPtrList<Incidence> subTodos; Incidence *aTodo; subTodos = t->relations(); for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { if (! removeCompletedSubTodos( (Todo*) aTodo )) deleteTodo = false; } if ( deleteTodo ) { if ( t->isCompleted() ) { checkZaurusId( t->zaurusId(), true ); mCalendar->deleteTodo( t ); changeTodoDisplay( t,KOGlobals::EVENTDELETED ); } else deleteTodo = false; } return deleteTodo; } void CalendarView::purgeCompleted() { int result = KMessageBox::warningContinueCancel(this, i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); if (result == KMessageBox::Continue) { QPtrList<Todo> todoCal; QPtrList<Todo> rootTodos; //QPtrList<Incidence> rel; Todo *aTodo;//, *rTodo; Incidence *rIncidence; bool childDelete = false; bool deletedOne = true; todoCal = calendar()->todos(); for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { if ( !aTodo->relatedTo() ) rootTodos.append( aTodo ); } for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { removeCompletedSubTodos( aTodo ); } updateView(); } } void CalendarView::slotCalendarChanged() { ; } NavigatorBar *CalendarView::navigatorBar() { return mNavigatorBar; } void CalendarView::keyPressEvent ( QKeyEvent *e) { //qDebug(" alendarView::keyPressEvent "); e->ignore(); } -#include "calendarview.moc" +//#include "calendarview.moc" -#include "calendarviewbase.moc" +//#include "calendarviewbase.moc" diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index 8d35c42..e26e20b 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp @@ -159,129 +159,129 @@ void DateNavigator::selectWeek( int num ) ++year; if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) --year; QDate d = QDate ( year, 1,1); while ( d.dayOfWeek() != 4 ) d = d.addDays( 1 ); selectWeek( d.addDays ( (num-1) *7 ) ); } void DateNavigator::selectWeek( const QDate &d ) { int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); int weekStart = KGlobal::locale()->weekStartDay(); QDate firstDate = d.addDays( weekStart - dayOfWeek ); if ( weekStart != 1 && dayOfWeek < weekStart ) { firstDate = firstDate.addDays(-7 ); } selectDates( firstDate, 7 ); } void DateNavigator::selectWorkWeek() { QDate d = mSelectedDates.first(); selectWorkWeek( d ); } void DateNavigator::selectWorkWeek( const QDate &d ) { int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); QDate firstDate = d.addDays( 1 - dayOfWeek ); int weekStart = KGlobal::locale()->weekStartDay(); if ( weekStart != 1 && dayOfWeek >= weekStart ) { firstDate = firstDate.addDays( 7 ); } selectDates( firstDate, 5 ); } void DateNavigator::selectToday() { QDate d = QDate::currentDate(); int dateCount = mSelectedDates.count(); if ( dateCount == 5 ) selectWorkWeek( d ); else if ( dateCount == 7 ) selectWeek( d ); else selectDates( d, dateCount ); } void DateNavigator::selectPreviousYear() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectPreviousMonth() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) selectMonthByDate( firstSelected ); else selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectNextMonth() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) selectMonthByDate( firstSelected ); else selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectNextYear() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectPrevious() { int offset = -7; if ( datesCount() == 1 ) { offset = -1; } if ( mViewManager ) if ( mViewManager->showsNextDays() ) offset = -datesCount(); selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); } void DateNavigator::selectNext() { int offset = 7; if ( datesCount() == 1 ) { offset = 1; } if ( mViewManager ) if ( mViewManager->showsNextDays() ) offset = datesCount(); selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); } void DateNavigator::emitSelected() { emit datesSelected( mSelectedDates ); } -#include "datenavigator.moc" +//#include "datenavigator.moc" diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp index 2943e41..ca09844 100644 --- a/korganizer/filtereditdialog.cpp +++ b/korganizer/filtereditdialog.cpp @@ -1,171 +1,171 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qpushbutton.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qradiobutton.h> #include <qlistbox.h> #include <qapplication.h> #include <kdebug.h> #include <klocale.h> #include <klineeditdlg.h> #include <kmessagebox.h> #include <libkdepim/categoryselectdialog.h> #include "koprefs.h" #include "filteredit_base.h" #include "filtereditdialog.h" -#include "filtereditdialog.moc" +//#include "filtereditdialog.moc" // TODO: Make dialog work on a copy of the filters objects. class ComboFilterBox: public QComboBox { public: ComboFilterBox( QWidget *parent=0, const char *name=0) : QComboBox( parent,name ) { } void popupBox() { popup(); } }; FilterEditDialog::FilterEditDialog(QPtrList<CalFilter> *filters,QWidget *parent, const char *name) : KDialogBase(parent,name,true,i18n("Edit Calendar Filters"), Ok|Apply|Cancel) { mFilters = filters; QWidget *mainWidget = new QWidget(this); setMainWidget(mainWidget); mSelectionCombo = new ComboFilterBox(mainWidget); connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected())); // mSelectionCombo->setEditable ( true ); QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget); connect(addButton,SIGNAL(clicked()),SLOT(slotAdd())); addButton->setMaximumSize( addButton->sizeHint()); mRemoveButton = new QPushButton( i18n("Remove"), mainWidget ); connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) ); mRemoveButton->setMaximumSize( mRemoveButton->sizeHint()); QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget); upButton->setMaximumSize( upButton->sizeHint()); connect(upButton,SIGNAL(clicked()),SLOT(slotUp())); mEditor = new FilterEdit_base(mainWidget); QGridLayout *topLayout = new QGridLayout(mainWidget,2,2); topLayout->setSpacing(spacingHint()); topLayout->addWidget(mSelectionCombo,0,0); topLayout->addWidget(upButton,0,1); topLayout->addWidget(addButton,0,2); topLayout->addWidget(mRemoveButton,0,3); topLayout->addMultiCellWidget(mEditor,1,1,0,3); mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() - addButton->maximumWidth() - mRemoveButton->maximumWidth() - upButton->maximumWidth() - spacingHint() * 5 ); connect(mEditor->mCatEditButton,SIGNAL(clicked()), SLOT(editCategorySelection())); // Clicking cancel exits the dialog without saving connect(this,SIGNAL(cancelClicked()),SLOT(reject())); updateFilterList(); } FilterEditDialog::~FilterEditDialog() { } void FilterEditDialog::slotUp() { if ( mFilters->count() <= 1 ) return; if ( mSelectionCombo->currentItem() == 0 ) return; int num = mSelectionCombo->currentItem(); CalFilter* f = new CalFilter( ); *f = *(mFilters->at( num )); mFilters->remove( num ); mFilters->insert( num-1, f ); updateFilterList(); mSelectionCombo->setCurrentItem( num-1 ); readFilter(f); //qApp->processEvents(); //mSelectionCombo->popupBox(); } void FilterEditDialog::updateFilterList() { mSelectionCombo->clear(); CalFilter *filter = mFilters->first(); if (!filter) { enableButtonOK(false); enableButtonApply(false); } else { while(filter) { mSelectionCombo->insertItem(filter->name()); filter = mFilters->next(); } CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); if (f) readFilter(f); enableButtonOK(true); enableButtonApply(true); } mRemoveButton->setEnabled( mFilters->count() > 1 ); } void FilterEditDialog::slotDefault() { } void FilterEditDialog::slotApply() { CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); writeFilter(f); emit filterChanged(); } void FilterEditDialog::accept() { slotOk(); } void FilterEditDialog::slotOk() { CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); writeFilter(f); emit filterChanged(); QDialog::accept(); } void FilterEditDialog::slotAdd() { KLineEditDlg dlg(i18n("Enter filter name:"), "New Filter", this); dlg.setCaption(i18n("Add Filter")); diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp index 490d21e..f3bd09f 100644 --- a/korganizer/incomingdialog.cpp +++ b/korganizer/incomingdialog.cpp @@ -399,129 +399,129 @@ bool IncomingDialog::incomeDefault(ScheduleItemIn *item) return false; } bool IncomingDialog::incomeRequest(ScheduleItemIn *item) { if (item->event()->type()=="FreeBusy") { //handel freebusy request IncidenceBase *inc = item->event(); QDateTime start = inc->dtStart(); QDateTime end = start.addDays(inc->duration()/86400); FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); freebusy->setOrganizer(inc->organizer()); Attendee *att = new Attendee(KOPrefs::instance()->fullName(), KOPrefs::instance()->email()); freebusy->addAttendee(att); kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " << KGlobal::locale()->formatDateTime( start ) << " End Date: " << KGlobal::locale()->formatDateTime( end ) << endl; if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) { delete item; emit numMessagesChanged(mMessageListView->childCount()); delete(freebusy); return true; } return false; } else { return incomeDefault(item); } return false; } bool IncomingDialog::automaticAction(ScheduleItemIn *item) { bool autoAction = false; IncidenceBase *inc = item->event(); Scheduler::Method method = item->method(); if( inc->type()=="FreeBusy" ) { if ( method==Scheduler::Request ) { if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { // reply freebusy information if ( checkOrganizerInAddressbook(inc->organizer()) ) { incomeRequest(item); } } else return false; } else { if ( method==Scheduler::Reply ) { if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { // insert freebusy information //if ( checkAttendeesInAddressbook(inc) ) } else return false; } else { if ( method==Scheduler::Publish) { if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { // insert freebusy information //if ( checkOrganizerInAddressbook(inc->organizer()) ) } } else return false; } } } if ( inc->type()=="Event" ) { if ( method==Scheduler::Request || method==Scheduler::Publish ) { if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) { // insert event if ( checkOrganizerInAddressbook(inc->organizer()) ) autoAction = acceptMessage(item); } else return false; } else { if ( method==Scheduler::Reply ) { if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) { // update event information if ( checkAttendeesInAddressbook(inc) ) autoAction = acceptMessage(item); } else return false; } else { if ( method==Scheduler::Refresh ) { if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) { // send refresh-information if ( checkAttendeesInAddressbook(inc) ) autoAction = acceptMessage(item); else return false; } else return false; } else return false; } } } return autoAction; } bool IncomingDialog::checkOrganizerInAddressbook(QString organizer) { bool inBook = false; #ifndef KORG_NOKABC KABC::AddressBook *add_book = KABC::StdAddressBook::self(); KABC::Addressee::List addressList; addressList = add_book->findByEmail(organizer); if ( addressList.size()>0 ) inBook = true; #endif return inBook; } bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc) { bool inBook = false; #ifndef KORG_NOKABC KABC::AddressBook *add_book = KABC::StdAddressBook::self(); KABC::Addressee::List addressList; QPtrList <Attendee> attendees; Attendee *att; attendees = inc->attendees(); for (att=attendees.first();att;att=attendees.next()) { addressList = add_book->findByEmail(att->email()); if (addressList.size()>0 ) inBook = true; } #endif return inBook; } -#include "incomingdialog.moc" +//#include "incomingdialog.moc" diff --git a/korganizer/incomingdialog_base.cpp b/korganizer/incomingdialog_base.cpp index 91740a4..8589803 100644 --- a/korganizer/incomingdialog_base.cpp +++ b/korganizer/incomingdialog_base.cpp @@ -9,129 +9,129 @@ ****************************************************************************/ #include "incomingdialog_base.h" #include <qvariant.h> #include <qheader.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> /* * Constructs a IncomingDialog_base as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "IncomingDialog_base" ); IncomingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout"); PushButton4 = new QPushButton( this, "PushButton4" ); IncomingDialog_baseLayout->addWidget( PushButton4, 0, 1 ); PushButton7 = new QPushButton( this, "PushButton7" ); PushButton7->setDefault( TRUE ); IncomingDialog_baseLayout->addWidget( PushButton7, 5, 1 ); mMessageListView = new QListView( this, "mMessageListView" ); mMessageListView->addColumn( tr2i18n( "Summary" ) ); mMessageListView->addColumn( tr2i18n( "Start Date" ) ); mMessageListView->addColumn( tr2i18n( "Start Time" ) ); mMessageListView->addColumn( tr2i18n( "End Date" ) ); mMessageListView->addColumn( tr2i18n( "End Time" ) ); mMessageListView->addColumn( tr2i18n( "Organizer" ) ); mMessageListView->addColumn( tr2i18n( "Method" ) ); mMessageListView->addColumn( tr2i18n( "Status" ) ); mMessageListView->setAllColumnsShowFocus( FALSE ); IncomingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 5, 0, 0 ); PushButton7_2 = new QPushButton( this, "PushButton7_2" ); IncomingDialog_baseLayout->addWidget( PushButton7_2, 3, 1 ); PushButton8 = new QPushButton( this, "PushButton8" ); IncomingDialog_baseLayout->addWidget( PushButton8, 1, 1 ); PushButton9 = new QPushButton( this, "PushButton9" ); IncomingDialog_baseLayout->addWidget( PushButton9, 2, 1 ); QSpacerItem* spacer = new QSpacerItem( 20, 70, QSizePolicy::Minimum, QSizePolicy::Expanding ); IncomingDialog_baseLayout->addItem( spacer, 4, 1 ); languageChange(); resize( QSize(525, 262).expandedTo(minimumSizeHint()) ); // signals and slots connections connect( PushButton7, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( PushButton4, SIGNAL( clicked() ), this, SLOT( retrieve() ) ); connect( PushButton7_2, SIGNAL( clicked() ), this, SLOT( acceptAllMessages() ) ); // tab order setTabOrder( PushButton7, PushButton4 ); setTabOrder( PushButton4, PushButton7_2 ); setTabOrder( PushButton7_2, mMessageListView ); setTabOrder( mMessageListView, PushButton8 ); setTabOrder( PushButton8, PushButton9 ); } /* * Destroys the object and frees any allocated resources */ IncomingDialog_base::~IncomingDialog_base() { // no need to delete child widgets, Qt does it all for us } /* * Sets the strings of the subwidgets using the current * language. */ void IncomingDialog_base::languageChange() { setCaption( tr2i18n( "Scheduler - Incoming Messages" ) ); PushButton4->setText( tr2i18n( "Retrieve &Messages" ) ); PushButton7->setText( tr2i18n( "&Close" ) ); mMessageListView->header()->setLabel( 0, tr2i18n( "Summary" ) ); mMessageListView->header()->setLabel( 1, tr2i18n( "Start Date" ) ); mMessageListView->header()->setLabel( 2, tr2i18n( "Start Time" ) ); mMessageListView->header()->setLabel( 3, tr2i18n( "End Date" ) ); mMessageListView->header()->setLabel( 4, tr2i18n( "End Time" ) ); mMessageListView->header()->setLabel( 5, tr2i18n( "Organizer" ) ); mMessageListView->header()->setLabel( 6, tr2i18n( "Method" ) ); mMessageListView->header()->setLabel( 7, tr2i18n( "Status" ) ); PushButton7_2->setText( tr2i18n( "Accept A&ll" ) ); PushButton8->setText( tr2i18n( "&Accept" ) ); PushButton9->setText( tr2i18n( "&Reject" ) ); } void IncomingDialog_base::acceptAllMessages() { qWarning( "IncomingDialog_base::acceptAllMessages(): Not implemented yet" ); } void IncomingDialog_base::acceptMessage() { qWarning( "IncomingDialog_base::acceptMessage(): Not implemented yet" ); } void IncomingDialog_base::rejectMessage() { qWarning( "IncomingDialog_base::rejectMessage(): Not implemented yet" ); } void IncomingDialog_base::retrieve() { qWarning( "IncomingDialog_base::retrieve(): Not implemented yet" ); } -#include "incomingdialog_base.moc" +//#include "incomingdialog_base.moc" diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index d1d7946..7af5cf4 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -1,170 +1,170 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ // // Journal Entry #include <qlabel.h> #include <qlayout.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #include <ktextedit.h> #include "koprefs.h" #include <libkcal/journal.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #include "journalentry.h" -#include "journalentry.moc" +//#include "journalentry.moc" #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #endif JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : QFrame(parent) { mCalendar = calendar; mJournal = 0; mDirty = false; mTitleLabel = new QLabel(i18n("Title"),this); mTitleLabel->setMargin(2); mTitleLabel->setAlignment(AlignCenter); mEditor = new KTextEdit(this); connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); #endif mEditor->setWordWrap( KTextEdit::WidgetWidth ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(mTitleLabel); topLayout->addWidget(mEditor); mEditor->installEventFilter(this); } JournalEntry::~JournalEntry() { } void JournalEntry::setDate(const QDate &date) { writeJournal(); mTitleLabel->setText(KGlobal::locale()->formatDate(date)); mDate = date; } void JournalEntry::setJournal(Journal *journal) { writeJournal(); mJournal = journal; mEditor->setText(mJournal->description()); mDirty = false; } Journal *JournalEntry::journal() const { return mJournal; } void JournalEntry::setDirty() { mDirty = true; // kdDebug() << "JournalEntry::setDirty()" << endl; } void JournalEntry::clear() { mJournal = 0; mEditor->setText(""); } bool JournalEntry::eventFilter( QObject *o, QEvent *e ) { // kdDebug() << "JournalEntry::event received " << e->type() << endl; if ( e->type() == QEvent::FocusOut ) { writeJournal(); } if ( e->type() == QEvent::KeyPress ) { QKeyEvent * k = (QKeyEvent *) e; if ( k->state() == Qt::ControlButton ) { k->ignore(); //return true; } } return QFrame::eventFilter( o, e ); // standard event processing } void JournalEntry::writeJournal() { // kdDebug() << "JournalEntry::writeJournal()" << endl; if (!mDirty) return; if (mEditor->text().isEmpty()) { if ( mJournal ) { mDirty = false; bool conf = KOPrefs::instance()->mConfirm; KOPrefs::instance()->mConfirm = false; emit deleteJournal(mJournal); KOPrefs::instance()->mConfirm = conf; mJournal = 0; } return; } // kdDebug() << "JournalEntry::writeJournal()..." << endl; if (!mJournal) { mJournal = new Journal; mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); mCalendar->addJournal(mJournal); } mJournal->setDescription(mEditor->text()); mDirty = false; } void JournalEntry::flushEntry() { if (!mDirty) return; writeJournal(); } void JournalEntry::keyPressEvent ( QKeyEvent * e ) { e->ignore(); } diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 12e983b..7d0c516 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -236,129 +236,129 @@ void KDateNavigator::updateView() int i; // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; daymatrix->updateView(); // set the week numbers. for(i = 0; i < 6; i++) { QString weeknum; // remember, according to ISO 8601, the first week of the year is the // first week that contains a thursday. Thus we must subtract off 4, // not just 1. //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); if (dayOfYear % 7 != 0) weeknum.setNum(dayOfYear / 7 + 1); else weeknum.setNum(dayOfYear / 7); weeknos[i]->setText(weeknum); } setUpdatesEnabled( true ); // kdDebug() << "updateView() -> repaint()" << endl; repaint(); daymatrix->repaint(); } void KDateNavigator::updateConfig() { int day; for(int i=0; i<7; i++) { // take the first letter of the day name to be the abbreviation if (KGlobal::locale()->weekStartsMonday()) { day = i+1; } else { if (i==0) day = 7; else day = i; } QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, true ); if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); headings[i]->setText( dayName ); } updateDates(); updateView(); } void KDateNavigator::setShowWeekNums(bool enabled) { m_bShowWeekNums = enabled; for(int i=0; i<6; i++) { if(enabled) weeknos[i]->show(); else weeknos[i]->hide(); } resize(size()); } void KDateNavigator::selectDates(const DateList& dateList) { if (dateList.count() > 0) { mNavigatorBar->selectDates( dateList ); mSelectedDates = dateList; // set our record of the month and year that this datetbl is // displaying. m_MthYr = mSelectedDates.first(); // set our record of the first day of the week of the current // month. This needs to be done before calling dayToIndex, since it // relies on this information being up to date. QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); m_fstDayOfWk = dayone.dayOfWeek(); updateDates(); daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); updateView(); } } int KDateNavigator::dayNum(int row, int col) { return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; } int KDateNavigator::dayToIndex(int dayNum) { int row, col; row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) row++; col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; return row * 7 + col; } void KDateNavigator::wheelEvent (QWheelEvent *e) { if(e->delta()>0) emit goPrevious(); else emit goNext(); e->accept(); } bool KDateNavigator::eventFilter (QObject *o,QEvent *e) { if (e->type() == QEvent::MouseButtonPress) { int i; for(i=0;i<6;++i) { if (o == weeknos[i]) { QDate weekstart = daymatrix->getDate(i*7); emit weekClicked(weekstart); break; } } return true; } else { return false; } } -#include "kdatenavigator.moc" +//#include "kdatenavigator.moc" diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 607c250..6532705 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1,177 +1,176 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> Marcus Bains line. Copyright (c) 2001 Ali Rahimi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef _WIN32_ #define protected public #include <qwidget.h> #undef protected #endif #include <qintdict.h> #include <qdatetime.h> #include <qapplication.h> #include <qpopupmenu.h> #include <qcursor.h> #include <qpainter.h> #include <kdebug.h> #include <klocale.h> #include <kiconloader.h> #include <kglobal.h> #include "koagendaitem.h" #include "koprefs.h" #include "koglobals.h" #include "koagenda.h" -#include "koagenda.moc" #include <libkcal/event.h> #include <libkcal/todo.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #endif //extern bool globalFlagBlockPainting; extern int globalFlagBlockAgenda; extern int globalFlagBlockAgendaItemPaint; extern int globalFlagBlockAgendaItemUpdate; extern int globalFlagBlockStartup; //////////////////////////////////////////////////////////////////////////// MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) : QFrame(_agenda->viewport(),name), agenda(_agenda) { setLineWidth(0); setMargin(0); setBackgroundColor(Qt::red); minutes = new QTimer(this); connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); minutes->start(0, true); mTimeBox = new QLabel(this); mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); QPalette pal = mTimeBox->palette(); pal.setColor(QColorGroup::Foreground, Qt::red); mTimeBox->setPalette(pal); //mTimeBox->setAutoMask(true); agenda->addChild(mTimeBox); oldToday = -1; } MarcusBains::~MarcusBains() { delete minutes; } int MarcusBains::todayColumn() { QDate currentDate = QDate::currentDate(); DateList dateList = agenda->dateList(); DateList::ConstIterator it; int col = 0; for(it = dateList.begin(); it != dateList.end(); ++it) { if((*it) == currentDate) return KOGlobals::self()->reverseLayout() ? agenda->columns() - 1 - col : col; ++col; } return -1; } void MarcusBains::updateLoc() { updateLocation(); } void MarcusBains::updateLocation(bool recalculate) { QTime tim = QTime::currentTime(); //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); if((tim.hour() == 0) && (oldTime.hour()==23)) recalculate = true; int mins = tim.hour()*60 + tim.minute(); int minutesPerCell = 24 * 60 / agenda->rows(); int y = mins*agenda->gridSpacingY()/minutesPerCell; int today = recalculate ? todayColumn() : oldToday; int x = agenda->gridSpacingX()*today; bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); oldTime = tim; oldToday = today; if(disabled || (today<0)) { hide(); mTimeBox->hide(); return; } else { show(); mTimeBox->show(); } if(recalculate) setFixedSize(agenda->gridSpacingX(),1); agenda->moveChild(this, x, y); raise(); if(recalculate) //mTimeBox->setFont(QFont("helvetica",10)); mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); mTimeBox->adjustSize(); // the -2 below is there because there is a bug in this program // somewhere, where the last column of this widget is a few pixels // narrower than the other columns. int offs = (today==agenda->columns()-1) ? -4 : 0; agenda->moveChild(mTimeBox, x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, y-mTimeBox->height()); mTimeBox->raise(); //mTimeBox->setAutoMask(true); minutes->start(5000,true); } //////////////////////////////////////////////////////////////////////////// /* Create an agenda widget with rows rows and columns columns. */ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, const char *name,WFlags f) : QScrollView(parent,name,f) { mColumns = columns; mRows = rows; mGridSpacingY = rowSize; mAllDayMode = false; #ifndef DESKTOP_VERSION diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 02fd33b..a39feb1 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -1,178 +1,178 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlabel.h> #include <qlayout.h> #include <qhbox.h> #include <qvbox.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qdragobject.h> #include <qdrawutil.h> #include <qpainter.h> #include <kiconloader.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #define AGENDA_ICON_SIZE 5 #else #define AGENDA_ICON_SIZE 7 #endif #include <libkcal/icaldrag.h> #include <libkcal/vcaldrag.h> #include <libkdepim/kincidenceformatter.h> extern int globalFlagBlockAgenda; extern int globalFlagBlockAgendaItemPaint; extern int globalFlagBlockAgendaItemUpdate; #include "koprefs.h" #include "koagendaitem.h" -#include "koagendaitem.moc" +//#include "koagendaitem.moc" //-------------------------------------------------------------------------- QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; //-------------------------------------------------------------------------- KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, const char *name,WFlags) : QWidget(parent, name), mIncidence(incidence), mDate(qd) { #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); #endif int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase setWFlags ( wflags); mAllDay = allday; init ( incidence, qd ); setMouseTracking(true); //setAcceptDrops(true); xPaintCoord = -1; yPaintCoord = -1; } void KOAgendaItem::init ( Incidence *incidence, QDate qd ) { mIncidence = incidence; mDate = qd; mFirstMultiItem = 0; mNextMultiItem = 0; mLastMultiItem = 0; computeText(); if ( (incidence->type() == "Todo") && ( !((static_cast<Todo*>(incidence))->isCompleted()) && ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; else mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; } else { QStringList categories = mIncidence->categories(); QString cat = categories.first(); if (cat.isEmpty()) { mBackgroundColor =KOPrefs::instance()->mEventColor; } else { mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); } } mColorGroup = QColorGroup( mBackgroundColor.light(), mBackgroundColor.dark(),mBackgroundColor.light(), mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; setBackgroundColor( mBackgroundColor ); setCellXY(0,0,1); setCellXWidth(0); setSubCell(0); setSubCells(1); setMultiItem(0,0,0); startMove(); mSelected = true; select(false); QString tipText = mIncidence->summary(); // QToolTip::add(this,tipText); QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); if ( !mIncidence->doesFloat() ) if ( mIncidence->type() == "Event" ) { if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); } else { tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); } } else if ( mIncidence->type() == "Todo" ) { tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); } if (!mIncidence->location().isEmpty()) { tipText += "\n"+i18n("Location: ")+mIncidence->location(); } QToolTip::add(this,tipText,toolTipGroup(),""); QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); mFontPixelSize = fontinf.height();; hide(); xPaintCoord = -1; yPaintCoord = -1; } KOAgendaItem::~KOAgendaItem() { // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); } void KOAgendaItem::recreateIncidence() { Incidence* newInc = mIncidence->clone(); newInc->recreate(); if ( mIncidence->doesRecur() ) { mIncidence->addExDate( mDate ); newInc->recurrence()->unsetRecurs(); int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); QTime tim = mIncidence->dtStart().time(); newInc->setDtStart( QDateTime(mDate, tim) ); ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); } mIncidence = newInc; } bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) { int size = AGENDA_ICON_SIZE; int yOff = 0; int xOff = 0; int x = pos().x() +3; int y; if ( mAllDay ) y = pos().y()+3; else y = mCellYTop * ( height() / cellHeight() ) +3; if (mIncidence->cancelled()) { int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 9e057e4..77a3164 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1,197 +1,197 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qhbox.h> #include <qvbox.h> #include <qlabel.h> #include <qframe.h> #include <qlayout.h> #ifndef KORG_NOSPLITTER #include <qsplitter.h> #endif #include <qfont.h> #include <qfontmetrics.h> #include <qpopupmenu.h> #include <qtooltip.h> #include <qpainter.h> #include <qpushbutton.h> #include <qapplication.h> #include <kapplication.h> #include <KDGanttMinimizeSplitter.h> #include <kdebug.h> #include <kstandarddirs.h> #include <kiconloader.h> #include <klocale.h> #include <kconfig.h> #include <kglobal.h> #include "calendarview.h" #include "koviewmanager.h" #include <libkcal/calendar.h> #include <libkcal/icaldrag.h> #include <libkcal/dndfactory.h> #include <kcalendarsystem.h> #include "koglobals.h" #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include "koprefs.h" #include "koagenda.h" #include "koagendaitem.h" #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "koagendaview.h" -#include "koagendaview.moc" +//#include "koagendaview.moc" //extern bool globalFlagBlockPainting; extern int globalFlagBlockAgenda; extern int globalFlagBlockStartup; extern int globalFlagBlockAgendaItemPaint; extern int globalFlagBlockAgendaItemUpdate; extern int globalFlagBlockLabel; using namespace KOrg; TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : QScrollView(parent,name,f) { mRows = rows; setMinimumHeight( 20 ); mCellHeight = KOPrefs::instance()->mHourSize*4; enableClipper(true); setHScrollBarMode(AlwaysOff); setVScrollBarMode(AlwaysOff); resizeContents(50,mRows * mCellHeight); viewport()->setBackgroundMode( PaletteBackground ); } void TimeLabels::setCellHeight(int height) { mCellHeight = height; } /* Optimization so that only the "dirty" portion of the scroll view is redrawn. Unfortunately, this is not called by default paintEvent() method. */ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) { // if ( globalFlagBlockAgenda ) // return; // bug: the parameters cx, cy, cw, ch are the areas that need to be // redrawn, not the area of the widget. unfortunately, this // code assumes the latter... // now, for a workaround... // these two assignments fix the weird redraw bug cx = contentsX() + 2; cw = contentsWidth() - 2; // end of workaround int cell = ((int)(cy/mCellHeight)); int y = cell * mCellHeight; QFontMetrics fm = fontMetrics(); QString hour; QString suffix; QString fullTime; int tW = fm.width("24:00i"); while (y < cy + ch) { p->drawLine(cx,y,cx+tW,y); hour.setNum(cell); suffix = "am"; // handle 24h and am/pm time formats if (KGlobal::locale()->use12Clock()) { if (cell > 11) suffix = "pm"; if (cell == 0) hour.setNum(12); if (cell > 12) hour.setNum(cell - 12); } else { suffix = ":00"; } // create string in format of "XX:XX" or "XXpm/am" fullTime = hour + suffix; // center and draw the time label int timeWidth = fm.width(fullTime+"i"); int offset = this->width() - timeWidth; int borderWidth = 5; int timeHeight = fm.height(); timeHeight = timeHeight + 2 - ( timeHeight / 4 ); p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); // increment indices y += mCellHeight; cell++; } } /** Calculates the minimum width. */ int TimeLabels::minimumWidth() const { QFontMetrics fm = fontMetrics(); //TODO: calculate this value int borderWidth = 4; // the maximum width possible int width = fm.width("88:88x") + borderWidth; return width; } /** updates widget's internal state */ void TimeLabels::updateConfig() { // set the font // config->setGroup("Fonts"); // QFont font = config->readFontEntry("TimeBar Font"); setFont(KOPrefs::instance()->mTimeBarFont); // update geometry restrictions based on new settings setFixedWidth(minimumWidth()); // update HourSize mCellHeight = KOPrefs::instance()->mHourSize*4; resizeContents(50,mRows * mCellHeight); } /** update time label positions */ void TimeLabels::positionChanged() { int adjustment = mAgenda->contentsY(); setContentsPos(0, adjustment); } diff --git a/korganizer/kocounterdialog.cpp b/korganizer/kocounterdialog.cpp index 8a9ae44..82a7072 100644 --- a/korganizer/kocounterdialog.cpp +++ b/korganizer/kocounterdialog.cpp @@ -1,66 +1,66 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <klocale.h> #include <libkcal/event.h> #include "koeventviewer.h" #include "kocounterdialog.h" -#include "kocounterdialog.moc" +//#include "kocounterdialog.moc" KOCounterDialog::KOCounterDialog(QWidget *parent,const char *name) : KDialogBase(parent,name,false,i18n("Counter-event Viewer"),User1|User2,User1, false,i18n("Decline"),i18n("Accept")) { mEventViewer = new KOEventViewer(this); setMainWidget(mEventViewer); connect(this,SIGNAL(user1Clicked()),this,SLOT(slotCancel())); connect(this,SIGNAL(user2Clicked()),this,SLOT(slotOk())); // TODO: Set a sensible size (based on the content?). setMinimumSize(300,200); resize(320,300); } KOCounterDialog::~KOCounterDialog() { } void KOCounterDialog::setEvent(Event *event) { mEventViewer->setEvent(event); } void KOCounterDialog::addEvent(Event *event) { mEventViewer->addEvent(event); } void KOCounterDialog::setTodo(Todo *event) { mEventViewer->setTodo(event); } void KOCounterDialog::addText(QString text) { mEventViewer->addText(text); } diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 779d67c..fc00828 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -1,177 +1,176 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> Parts of the source code have been copied from kdpdatebutton.cpp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qevent.h> #include <qpainter.h> #include <qptrlist.h> #include <kglobal.h> #include <kdebug.h> #include <klocale.h> #include <libkcal/vcaldrag.h> #include <libkcal/icaldrag.h> #include <libkcal/dndfactory.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #include <kcalendarsystem.h> #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include "koprefs.h" #include "koglobals.h" #include "kodaymatrix.h" -#include "kodaymatrix.moc" // ============================================================================ // D Y N A M I C T I P // ============================================================================ DynamicTip::DynamicTip( QWidget * parent ) : QToolTip( parent ) { matrix = (KODayMatrix*)parent; } void DynamicTip::maybeTip( const QPoint &pos ) { //calculate which cell of the matrix the mouse is in QRect sz = matrix->frameRect(); int dheight = sz.height()*7 / 42; int dwidth = sz.width() / 7; int row = pos.y()/dheight; int col = pos.x()/dwidth; QRect rct(col*dwidth, row*dheight, dwidth, dheight); // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << // col << "][" << row << "] => " <<(col+row*7) << endl; //show holiday names only QString str = matrix->getHolidayLabel(col+row*7); if (str.isEmpty()) return; tip(rct, str); } // ============================================================================ // K O D A Y M A T R I X // ============================================================================ const int KODayMatrix::NOSELECTION = -1000; const int KODayMatrix::NUMDAYS = 42; KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : QFrame(parent, name) { mCalendar = calendar; // initialize dynamic arrays days = new QDate[NUMDAYS]; daylbls = new QString[NUMDAYS]; events = new int[NUMDAYS]; mToolTip = new DynamicTip(this); // set default values used for drawing the matrix mDefaultBackColor = palette().active().base(); mDefaultTextColor = palette().active().foreground(); mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); mSelectedDaysColor = QColor("white"); mTodayMarginWidth = 2; mSelEnd = mSelStart = NOSELECTION; setAcceptDrops(true); //setFont( QFont("Arial", 10) ); updateView(date); } QColor KODayMatrix::getShadedColor(QColor color) { QColor shaded; int h=0; int s=0; int v=0; color.hsv(&h,&s,&v); s = s/4; v = 192+v/4; shaded.setHsv(h,s,v); return shaded; } KODayMatrix::~KODayMatrix() { delete [] days; delete [] daylbls; delete [] events; delete mToolTip; } /* void KODayMatrix::setStartDate(QDate start) { updateView(start); } */ void KODayMatrix::addSelectedDaysTo(DateList& selDays) { kdDebug() << "KODayMatrix::addSelectedDaysTo() - " << "mSelStart:" << mSelStart << endl; if (mSelStart == NOSELECTION) { return; } //cope with selection being out of matrix limits at top (< 0) int i0 = mSelStart; if (i0 < 0) { for (int i = i0; i < 0; i++) { selDays.append(days[0].addDays(i)); } i0 = 0; } //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) if (mSelEnd > NUMDAYS-1) { for (int i = i0; i <= NUMDAYS-1; i++) { selDays.append(days[i]); } for (int i = NUMDAYS; i < mSelEnd; i++) { selDays.append(days[0].addDays(i)); } // apply normal routine to selection being entirely within matrix limits } else { for (int i = i0; i <= mSelEnd; i++) { selDays.append(days[i]); } } } diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index caf7599..58198a2 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp @@ -1,171 +1,170 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <libkdepim/categoryeditdialog.h> #include "calendarview.h" #include "incomingdialog.h" #include "outgoingdialog.h" #include "koprefsdialog.h" #include "koeventeditor.h" #include "koprefs.h" #include "datenavigator.h" #include "kotodoeditor.h" #include "searchdialog.h" #include "filtereditdialog.h" #ifndef KORG_NOPLUGINS #include "plugindialog.h" #endif #ifndef KORG_NOARCHIVE #include "archivedialog.h" #endif #include "kconfig.h" #include "kodialogmanager.h" -#include "kodialogmanager.moc" KODialogManager::KODialogManager( CalendarView *mainView ) : QObject(), mMainView( mainView ) { mOutgoingDialog = 0; mIncomingDialog = 0; mOptionsDialog = 0; mSearchDialog = 0; mArchiveDialog = 0; mFilterEditDialog = 0; mPluginDialog = 0; // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); } KODialogManager::~KODialogManager() { delete mOutgoingDialog; delete mIncomingDialog; delete mOptionsDialog; delete mSearchDialog; #ifndef KORG_NOARCHIVE delete mArchiveDialog; #endif delete mFilterEditDialog; #ifndef KORG_NOPLUGINS delete mPluginDialog; #endif } OutgoingDialog *KODialogManager::outgoingDialog() { createOutgoingDialog(); return mOutgoingDialog; } void KODialogManager::createOutgoingDialog() { if (!mOutgoingDialog) { mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), mMainView,SIGNAL(numOutgoingChanged(int))); } } void KODialogManager::showOptionsDialog( bool showSync ) { int curLanguage = KOPrefs::instance()->mPreferredLanguage; if (!mOptionsDialog) { mOptionsDialog = new KOPrefsDialog(mMainView); //mOptionsDialog->readConfig(); connect(mOptionsDialog,SIGNAL(configChanged()), mMainView,SLOT(updateConfig())); //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), // mOptionsDialog,SLOT(updateCategories())); } mOptionsDialog->readConfig(); #ifndef DESKTOP_VERSION mOptionsDialog->showMaximized(); #else mOptionsDialog->show(); #endif if ( showSync ) mOptionsDialog->showSyncPage(); mOptionsDialog->exec(); if ( curLanguage != KOPrefs::instance()->mPreferredLanguage ) KOPrefs::instance()->mLanguageChanged = true; } void KODialogManager::showSyncOptions() { showOptionsDialog( true ); } void KODialogManager::showOutgoingDialog() { createOutgoingDialog(); mOutgoingDialog->show(); mOutgoingDialog->raise(); } IncomingDialog *KODialogManager::incomingDialog() { createOutgoingDialog(); if (!mIncomingDialog) { mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), mMainView,SIGNAL(numIncomingChanged(int))); connect(mIncomingDialog,SIGNAL(calendarUpdated()), mMainView,SLOT(updateView())); } return mIncomingDialog; } void KODialogManager::createIncomingDialog() { createOutgoingDialog(); if (!mIncomingDialog) { mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), mMainView,SIGNAL(numIncomingChanged(int))); connect(mIncomingDialog,SIGNAL(calendarUpdated()), mMainView,SLOT(updateView())); } } void KODialogManager::showIncomingDialog() { createIncomingDialog(); mIncomingDialog->show(); mIncomingDialog->raise(); } /* void KODialogManager::showCategoryEditDialog() { mCategoryEditDialog->show(); } */ void KODialogManager::hideSearchDialog() { if (mSearchDialog) mSearchDialog->hide(); } void KODialogManager::showSearchDialog() { diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 7c4c382..c0e7bdd 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp @@ -1,176 +1,175 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in thse hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qfiledialog.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qapp.h> #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include <kstandarddirs.h> #include <kmessagebox.h> #ifndef KORG_NOKABC #include <kabc/addresseedialog.h> #endif #include <libkcal/incidence.h> #include "koprefs.h" #include "koeditordetails.h" -#include "koeditordetails.moc" template <> CustomListViewItem<class Attendee *>::~CustomListViewItem() { delete mData; } template <> void CustomListViewItem<class Attendee *>::updateItem() { setText(0,mData->name()); setText(1,mData->email()); setText(2,mData->roleStr()); setText(3,mData->statusStr()); if (mData->RSVP() && !mData->email().isEmpty()) setPixmap(4,SmallIcon("mailappt")); else setPixmap(4,SmallIcon("nomailappt")); } KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) : QWidget( parent, name), mDisableItemUpdate( false ) { QGridLayout *topLayout = new QGridLayout(this); topLayout->setSpacing(spacing); QString organizer = KOPrefs::instance()->email(); mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); mListView = new KListView(this,"mListView"); mListView->addColumn(i18n("Name"),180); mListView->addColumn(i18n("Email"),180); mListView->addColumn(i18n("Role"),60); mListView->addColumn(i18n("Status"),100); mListView->addColumn(i18n("RSVP"),35); if ( KOPrefs::instance()->mCompactDialogs ) { //mListView->setFixedHeight(78); } connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateAttendeeInput())); QLabel *attendeeLabel = new QLabel(this); attendeeLabel->setText(i18n("Name:")); attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); mNameEdit = new QLineEdit(this); connect(mNameEdit,SIGNAL(textChanged(const QString &)), SLOT(updateAttendeeItem())); mUidEdit = new QLineEdit(0); mUidEdit->setText(""); QLabel *emailLabel = new QLabel(this); emailLabel->setText(i18n("Email:")); mEmailEdit = new QLineEdit(this); connect(mEmailEdit,SIGNAL(textChanged(const QString &)), SLOT(updateAttendeeItem())); QLabel *attendeeRoleLabel = new QLabel(this); attendeeRoleLabel->setText(i18n("Role:")); mRoleCombo = new QComboBox(false,this); mRoleCombo->insertStringList(Attendee::roleList()); connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); QLabel *statusLabel = new QLabel(this); statusLabel->setText( i18n("Status:") ); mStatusCombo = new QComboBox(false,this); mStatusCombo->insertStringList(Attendee::statusList()); connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); mRsvpButton = new QCheckBox(this); mRsvpButton->setText(i18n("Request response")); connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); QWidget *buttonBox = new QWidget(this); QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); buttonLayout->addWidget(newButton); connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); buttonLayout->addWidget(mRemoveButton); connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); // buttonLayout->addWidget(mAddressBookButton); connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); if (qApp->desktop()->width() < 300 ) { mListView->setFixedHeight(80); topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); topLayout->addMultiCellWidget(mListView,1,1,0,3); topLayout->addWidget(attendeeLabel,3,0); topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); topLayout->addWidget(emailLabel,4,0); topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); topLayout->addWidget(attendeeRoleLabel,5,0); topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); topLayout->addWidget(statusLabel,6,0); topLayout->addMultiCellWidget(mStatusCombo,6,6,1,2); topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); topLayout->addMultiCellWidget(buttonBox,3,4,3,3); topLayout->setRowStretch(1,2); topLayout->setColStretch(0,0); topLayout->setColStretch(1,2); topLayout->setColStretch(2,1); topLayout->setColStretch(3,1); } else { topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); topLayout->addMultiCellWidget(mListView,1,1,0,5); topLayout->addWidget(attendeeLabel,3,0); topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); topLayout->addWidget(emailLabel,4,0); topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); topLayout->addWidget(attendeeRoleLabel,5,0); topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); topLayout->addWidget(statusLabel,5,3); topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); topLayout->addMultiCellWidget(buttonBox,3,4,5,5); topLayout->setRowStretch(1,5); topLayout->setColStretch(0,0); diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index ad1389f..94e1f4c 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -1,181 +1,180 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qwidget.h> #include <qtooltip.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qfile.h> #include <kglobal.h> #include <kdebug.h> #include <klocale.h> #include <kiconloader.h> #include <kmessagebox.h> #include <kfiledialog.h> #include <kstandarddirs.h> #include <libkcal/todo.h> #include <libkcal/event.h> #include <libkdepim/categoryselectdialog.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "koglobals.h" #include "koeditorgeneral.h" #include "kolocationbox.h" -#include "koeditorgeneral.moc" #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : QObject( parent, name) { } KOEditorGeneral::~KOEditorGeneral() { } void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) { QGridLayout *headerLayout = new QGridLayout(topLayout); #if 0 mOwnerLabel = new QLabel(i18n("Owner:"),parent); headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); #endif QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); headerLayout->addWidget(summaryLabel,1,0); mSummaryEdit = new KOLocationBox(TRUE,parent, 10); mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; if ( QApplication::desktop()->width() > 320 ) mSummaryEdit->setMaximumHeight( hei +6 ); //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } // mSummaryEdit = new QLineEdit(parent); headerLayout->addWidget(mSummaryEdit,1,1); connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); QLabel *locationLabel = new QLabel(i18n("Location:"),parent); headerLayout->addWidget(locationLabel,2,0); mLocationEdit = new KOLocationBox(TRUE,parent,10); mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); if ( QApplication::desktop()->width() > 320 ) mLocationEdit->setMaximumHeight( hei + 6); // mLocationEdit = new QLineEdit(parent); connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); headerLayout->addWidget(mLocationEdit,2,1); headerLayout->setColStretch( 1, 10); } void KOEditorGeneral::setFocusOn( int i ) { qApp->processEvents(); if ( i == 1 ) { mDescriptionEdit->setFocus(); mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); } if ( i == 2 ) { mSummaryEdit->setFocus(); } } void KOEditorGeneral::editCategories() { // qDebug("KOEditorGeneral::editCategories() "); KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); //KOGlobals::fitDialogToScreen( csd ); csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); csd->exec(); delete csd; } void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) { QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); mCategoriesButton = new QPushButton(parent); mCategoriesButton->setText(i18n("Categories...")); connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); categoriesLayout->addWidget(mCategoriesButton); mCategoriesLabel = new QLabel(parent); mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); categoriesLayout->addWidget(mCategoriesLabel,1); } void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) { QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); secrecyLayout->addWidget(mCancelBox); secrecyLayout->addWidget(secrecyLabel); mSecrecyCombo = new QComboBox(parent); mSecrecyCombo->insertStringList(Incidence::secrecyList()); secrecyLayout->addWidget(mSecrecyCombo); } void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) { mDescriptionEdit = new KTextEdit(parent); mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); mDescriptionEdit->append(""); mDescriptionEdit->setReadOnly(false); mDescriptionEdit->setOverwriteMode(false); mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); topLayout->addWidget(mDescriptionEdit); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); #endif } void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); //mAlarmBell = new QLabel(parent); //mAlarmBell->setPixmap(SmallIcon("bell")); //alarmLayout->addWidget(mAlarmBell); if ( QApplication::desktop()->width() < 320 ) mAlarmButton = new QCheckBox(i18n("Rem."),parent); else diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index 9b93e7e..42c3df1 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp @@ -1,176 +1,175 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #include <kiconloader.h> #include <kmessagebox.h> #include <kfiledialog.h> #include <kstandarddirs.h> #include <libkcal/event.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "koeditorgeneralevent.h" #include "kolocationbox.h" -#include "koeditorgeneralevent.moc" KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, const char* name) : KOEditorGeneral( parent, name) { connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), SLOT(setDuration())); connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), SLOT(emitDateTimeStr())); } KOEditorGeneralEvent::~KOEditorGeneralEvent() { } void KOEditorGeneralEvent::finishSetup() { //disabled // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); mSummaryEdit->setFocus(); } void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *timeLayout = new QVBoxLayout(topLayout); QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, i18n("Date && Time"),parent); timeLayout->addWidget(timeGroupBox); timeGroupBox->layout()->setSpacing( 0 ); timeGroupBox->layout()->setMargin( 5 ); QFrame *timeBoxFrame = new QFrame(timeGroupBox); QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); layoutTimeBox->setSpacing(topLayout->spacing()); mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); layoutTimeBox->addWidget(mStartDateLabel,0,0); mStartDateEdit = new KDateEdit(timeBoxFrame); layoutTimeBox->addWidget(mStartDateEdit,0,1); mStartTimeEdit = new KOTimeEdit(timeBoxFrame); layoutTimeBox->addWidget(mStartTimeEdit,0,2); mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); layoutTimeBox->addWidget(mEndDateLabel,1,0); mEndDateEdit = new KDateEdit(timeBoxFrame); layoutTimeBox->addWidget(mEndDateEdit,1,1); mEndTimeEdit = new KOTimeEdit(timeBoxFrame); layoutTimeBox->addWidget(mEndTimeEdit,1,2); QWidget* duration = new QWidget( timeBoxFrame ); QHBoxLayout *flagsBox = new QHBoxLayout( duration ); mNoTimeButton = new QCheckBox(i18n("Allday"),duration); flagsBox->addWidget(mNoTimeButton); connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); mDurationLabel = new QLabel( duration ); // if ( KOPrefs::instance()->mCompactDialogs ) { //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); //} else { flagsBox->addWidget( mDurationLabel ); //} flagsBox->setStretchFactor(mDurationLabel, 10 ); mDurationLabel->setAlignment( AlignRight | AlignVCenter); layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); // time widgets are checked if they contain a valid time connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), this, SLOT(startTimeChanged(QTime))); connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), this, SLOT(endTimeChanged(QTime))); // date widgets are checked if they contain a valid date connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), this, SLOT(startDateChanged(QDate))); connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), this, SLOT(endDateChanged(QDate))); } void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *classLayout = new QHBoxLayout(topLayout); QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); classLayout->addWidget(freeTimeLabel); mFreeTimeCombo = new QComboBox(false, parent); mFreeTimeCombo->insertItem(i18n("Busy")); mFreeTimeCombo->insertItem(i18n("Free")); classLayout->addWidget(mFreeTimeCombo); } void KOEditorGeneralEvent::timeStuffDisable(bool disable) { mStartTimeEdit->setEnabled( !disable ); mEndTimeEdit->setEnabled( !disable ); setDuration(); emitDateTimeStr(); } void KOEditorGeneralEvent::dontAssociateTime(bool noTime) { timeStuffDisable(noTime); //if(alarmButton->isChecked()) alarmStuffDisable(noTime); allDayChanged(noTime); } void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 57837bb..7db7da0 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp @@ -1,179 +1,178 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qfiledialog.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <kglobal.h> #include <klocale.h> #include <kiconloader.h> #include <kmessagebox.h> #include <kdebug.h> #include <krestrictedline.h> #include <kstandarddirs.h> #include <kfiledialog.h> #include <libkcal/todo.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "ktimeedit.h" #include "koeditorgeneraltodo.h" #include "kolocationbox.h" -#include "koeditorgeneraltodo.moc" KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, const char* name) : KOEditorGeneral( parent, name) { } KOEditorGeneralTodo::~KOEditorGeneralTodo() { } void KOEditorGeneralTodo::finishSetup() { // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); // QWidget::setTabOrder(mLocationEdit, mDueCheck); // QWidget::setTabOrder(mDueCheck, mDueDateEdit); // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); // QWidget::setTabOrder(mStartCheck, mStartDateEdit); // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); // QWidget::setTabOrder(mTimeButton, mCompletedCombo); // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); mSummaryEdit->load(KOLocationBox::SUMMARYTODO); mSummaryEdit->setFocus(); } void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *timeLayout = new QVBoxLayout(topLayout); QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, i18n("Date && Time"),parent); timeLayout->addWidget(timeGroupBox); timeGroupBox->layout()->setSpacing( 0 ); timeGroupBox->layout()->setMargin( 5 ); QFrame *timeBoxFrame = new QFrame(timeGroupBox); QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); layoutTimeBox->setSpacing(topLayout->spacing()); layoutTimeBox->setColStretch( 1, 1 ); mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); layoutTimeBox->addWidget(mDueCheck,0,0); connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); mDueDateEdit = new KDateEdit(timeBoxFrame); layoutTimeBox->addWidget(mDueDateEdit,0,1); mDueTimeEdit = new KOTimeEdit(timeBoxFrame); layoutTimeBox->addWidget(mDueTimeEdit,0,2); mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); layoutTimeBox->addWidget(mStartCheck,1,0); connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); mStartDateEdit = new KDateEdit(timeBoxFrame); layoutTimeBox->addWidget(mStartDateEdit,1,1); mStartTimeEdit = new KOTimeEdit(timeBoxFrame); layoutTimeBox->addWidget(mStartTimeEdit,1,2); mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); // some more layouting //layoutTimeBox->setColStretch(3,1); } void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) { mCompletedCombo = new QComboBox(parent); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 0 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 20 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 40 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 60 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 80 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n("100 %")); connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); topLayout->addWidget(mCompletedCombo); mCompletedLabel = new QLabel(i18n("completed"),parent); topLayout->addWidget(mCompletedLabel); } void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) { QHBox* h = new QHBox ( parent ); topLayout->addWidget( h ); QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); // topLayout->addWidget(priorityLabel); mPriorityCombo = new QComboBox( h ); mPriorityCombo->insertItem(i18n("1 (high)")); mPriorityCombo->insertItem(i18n("2")); mPriorityCombo->insertItem(i18n("3")); mPriorityCombo->insertItem(i18n("4")); mPriorityCombo->insertItem(i18n("5 (low)")); //topLayout->addWidget(mPriorityCombo); } void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *statusLayout = new QHBoxLayout(topLayout); initCompletion( parent, statusLayout ); statusLayout->addStretch( 1 ); diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index d82172f..98356fe 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -1,179 +1,178 @@ /* This file is part of KOrganizer. Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qfiledialog.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qlistbox.h> #include <qspinbox.h> #include <qcheckbox.h> #include <qapplication.h> #include <kdialog.h> #include <kglobal.h> #include <klocale.h> #include <kiconloader.h> #include <kdebug.h> #include <knumvalidator.h> #include <libkcal/event.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "koeditorrecurrence.h" -#include "koeditorrecurrence.moc" /////////////////////////// RecurBase /////////////////////////////// RecurBase::RecurBase( QWidget *parent, const char *name ) : QWidget( parent, name ) { mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); mFrequencyEdit->setValue( 1 ); } QWidget *RecurBase::frequencyEdit() { return mFrequencyEdit; } void RecurBase::setFrequency( int f ) { if ( f < 1 ) f = 1; mFrequencyEdit->setValue( f ); } int RecurBase::frequency() { return mFrequencyEdit->value(); } /////////////////////////// RecurDaily /////////////////////////////// RecurDaily::RecurDaily( QWidget *parent, const char *name ) : RecurBase( parent, name ) { QBoxLayout *topLayout = new QHBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); QLabel *preLabel = new QLabel( i18n("Recur every"), this ); topLayout->addWidget( preLabel ); topLayout->addWidget( frequencyEdit() ); QLabel *postLabel = new QLabel( i18n("day(s)"), this ); topLayout->addWidget( postLabel ); } /////////////////////////// RecurWeekly /////////////////////////////// RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : RecurBase( parent, name ) { QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->addStretch( 1 ); QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); QLabel *preLabel = new QLabel( i18n("Recur every"), this ); weeksLayout->addWidget( preLabel ); weeksLayout->addWidget( frequencyEdit() ); QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); weeksLayout->addWidget( postLabel ); QHBox *dayBox = new QHBox( this ); topLayout->addWidget( dayBox, 1, AlignVCenter ); // TODO: Respect start of week setting for ( int i = 0; i < 7; ++i ) { QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); if ( KOPrefs::instance()->mCompactDialogs ) { weekDayName = weekDayName.left( 1 ); } mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); } topLayout->addStretch( 1 ); } void RecurWeekly::setDays( const QBitArray &days ) { for ( int i = 0; i < 7; ++i ) { mDayBoxes[ i ]->setChecked( days.testBit( i ) ); } } QBitArray RecurWeekly::days() { QBitArray days( 7 ); for ( int i = 0; i < 7; ++i ) { days.setBit( i, mDayBoxes[ i ]->isChecked() ); } return days; } /////////////////////////// RecurMonthly /////////////////////////////// RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : RecurBase( parent, name ) { QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); QLabel *preLabel = new QLabel( i18n("every"), this ); freqLayout->addWidget( preLabel ); freqLayout->addWidget( frequencyEdit() ); QLabel *postLabel = new QLabel( i18n("month(s)"), this ); freqLayout->addWidget( postLabel ); QButtonGroup *buttonGroup = new QButtonGroup( this ); buttonGroup->setFrameStyle( QFrame::NoFrame ); topLayout->addWidget( buttonGroup, 1, AlignVCenter ); QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); buttonLayout->setSpacing( KDialog::spacingHint() ); QString recurOnText; if ( !KOPrefs::instance()->mCompactDialogs ) { recurOnText = i18n("Recur on the"); diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index b3edec6..0ff99a4 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp @@ -1,178 +1,177 @@ /* This file is part of KOrganizer. Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qhbox.h> #include <qdir.h> #include <qlayout.h> #include <qwidgetstack.h> #include <qapplication.h> #include <kiconloader.h> #include <kstandarddirs.h> #include <kdebug.h> #include <klocale.h> #include <kfiledialog.h> #include <kmessagebox.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #include <libkdepim/categoryselectdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include "koprefs.h" #include "koeventeditor.h" -#include "koeventeditor.moc" extern int globalFlagBlockAgenda; KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) { mEvent = 0; init(); } KOEventEditor::~KOEventEditor() { //emit dialogClose( mEvent ); } void KOEventEditor::init() { setupGeneral(); setupAttendeesTab(); setupRecurrence(); // Propagate date time settings to recurrence tab connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), mRecurrence,SLOT(setDateTimeStr(const QString &))); // Category dialog // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), // mGeneral,SLOT(setCategories(const QString &))); } void KOEventEditor::reload() { if ( mEvent ) readEvent( mEvent ); } void KOEventEditor::setSecrecy( int sec ) { mGeneral->setSecrecy( sec ); } void KOEventEditor::setCategories( QString s ) { mGeneral->setCategories(s); } void KOEventEditor::setupGeneral() { mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); if( KOPrefs::instance()->mCompactDialogs ) { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); topLayout->setSpacing(spacingHint()-1); topLayout->setMargin(marginHint()-1); mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); mGeneral->initAlarm(topFrame,topLayout); mGeneral->enableAlarm( false ); QBoxLayout *buttonLayout; if ( QApplication::desktop()->width() < 500 ) buttonLayout = new QVBoxLayout( topLayout ); else buttonLayout = new QHBoxLayout( topLayout ); QHBox* buttonWidget = new QHBox (topFrame); QIconSet icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else icon = SmallIcon("fileexport"); QPushButton * loadTemplate = new QPushButton( buttonWidget); QPushButton * saveTemplate = new QPushButton( buttonWidget); saveTemplate->setIconSet (icon ) ; int size = saveTemplate->sizeHint().height(); saveTemplate->setFixedSize( size, size ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); else icon = SmallIcon("fileimport"); loadTemplate->setIconSet (icon ) ; loadTemplate->setFixedSize( size, size ); buttonLayout->addWidget( buttonWidget ); mGeneral->initCategories( topFrame, buttonLayout ); topLayout->addStretch( 1 ); QFrame *topFrame2 = addPage(i18n("Details")); QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); topLayout2->setSpacing(spacingHint()); mGeneral->initClass(topFrame2,topLayout2); mGeneral->initSecrecy( topFrame2, topLayout2 ); mGeneral->initDescription(topFrame2,topLayout2); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); } else { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); topLayout->setSpacing(spacingHint()); mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); mGeneral->initAlarm(topFrame,alarmLineLayout); mGeneral->initClass(topFrame,alarmLineLayout); mGeneral->initDescription(topFrame,topLayout); QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); mGeneral->initCategories( topFrame, detailsLayout ); mGeneral->initSecrecy( topFrame, detailsLayout ); } mGeneral->finishSetup(); } void KOEventEditor::setupRecurrence() { QFrame *topFrame = addPage( i18n("Recurrence") ); QBoxLayout *topLayout = new QVBoxLayout( topFrame ); diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 410bceb..b274810 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp @@ -1,114 +1,113 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qcursor.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <libkcal/event.h> #include "koeventpopupmenu.h" -#include "koeventpopupmenu.moc" KOEventPopupMenu::KOEventPopupMenu() { mCurrentIncidence = 0; mHasAdditionalItems = false; insertItem (i18n("&Show"),this,SLOT(popupShow())); mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); mEditOnlyItems.append(insertItem (i18n("&Delete"), this,SLOT(popupDelete()))); mEditOnlyItems.append(insertItem (i18n("&Clone..."), this,SLOT(popupClone()))); mEditOnlyItems.append(insertItem (i18n("&Move..."), this,SLOT(popupMove()))); #ifndef DESKTOP_VERSION mEditOnlyItems.append(insertItem (i18n("&Beam..."), this,SLOT(popupBeam()))); #endif mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), this,SLOT(popupCancel()))); } void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) { mCurrentIncidence = incidence; if (mCurrentIncidence) { // Enable/Disabled menu items only valid for editable events. QValueList<int>::Iterator it; for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); } popup(QCursor::pos()); } else { kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl; } } void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text, const QObject *receiver, const char *member, bool editOnly) { if (!mHasAdditionalItems) { mHasAdditionalItems = true; insertSeparator(); } int id = insertItem(icon,text,receiver,member); if (editOnly) mEditOnlyItems.append(id); } void KOEventPopupMenu::popupShow() { if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupEdit() { if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupDelete() { if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupClone() { if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupCancel() { if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupMove() { if (mCurrentIncidence) emit moveIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupBeam() { if (mCurrentIncidence) emit beamIncidenceSignal(mCurrentIncidence); } diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp index 4553b0b..bce2626 100644 --- a/korganizer/koeventview.cpp +++ b/korganizer/koeventview.cpp @@ -1,133 +1,130 @@ /* This file is part of KOrganizer. Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qpopupmenu.h> #include <qcursor.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <kmessagebox.h> #include <libkcal/calendar.h> #include "koprefs.h" #include "koeventview.h" using namespace KOrg; -#include "koeventview.moc" //--------------------------------------------------------------------------- KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name) : KOrg::BaseView(cal,parent,name) { } //--------------------------------------------------------------------------- KOEventView::~KOEventView() { } //--------------------------------------------------------------------------- KOEventPopupMenu *KOEventView::eventPopup() { KOEventPopupMenu *eventPopup = new KOEventPopupMenu; connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)), SIGNAL(editIncidenceSignal(Incidence *))); connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)), SIGNAL(showIncidenceSignal(Incidence *))); connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)), SIGNAL(deleteIncidenceSignal(Incidence *))); connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)), SIGNAL(cancelIncidenceSignal(Incidence *))); connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)), SIGNAL(cloneIncidenceSignal(Incidence *))); connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)), SIGNAL(beamIncidenceSignal(Incidence *))); connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)), SIGNAL(moveIncidenceSignal(Incidence *))); return eventPopup; } //--------------------------------------------------------------------------- void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event) { mCurrentIncidence = event; if (event) popup->popup(QCursor::pos()); else kdDebug() << "KOEventView::showEventPopup(): No event selected" << endl; } //--------------------------------------------------------------------------- void KOEventView::popupShow() { emit showIncidenceSignal(mCurrentIncidence); } //--------------------------------------------------------------------------- void KOEventView::popupEdit() { emit editIncidenceSignal(mCurrentIncidence); } //--------------------------------------------------------------------------- void KOEventView::popupDelete() { emit deleteIncidenceSignal(mCurrentIncidence); } void KOEventView::popupClone() { emit cloneIncidenceSignal(mCurrentIncidence); } void KOEventView::popupCancel() { emit cancelIncidenceSignal(mCurrentIncidence); } //--------------------------------------------------------------------------- void KOEventView::defaultAction( Incidence *incidence ) { if ( !incidence ) return; if ( incidence->isReadOnly() ) emit showIncidenceSignal(incidence); else { if ( KOPrefs::instance()->mEditOnDoubleClick ) emit editIncidenceSignal(incidence); else emit showIncidenceSignal(incidence); } } //--------------------------------------------------------------------------- -#include "baseview.moc" - diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 9f8bd9b..bac66d3 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -1,177 +1,176 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qcstring.h> #include <qwhatsthis.h> #include <qdialog.h> #include <qapplication.h> #include <qlabel.h> #include <qlayout.h> #include <klocale.h> #include <kapplication.h> #include <libkcal/event.h> #include <libkcal/todo.h> #include <kdebug.h> #include <kiconloader.h> #include <krun.h> #include <kglobal.h> #include <kprocess.h> #include "koprefs.h" #include <libkdepim/addresseeview.h> #include <kabc/stdaddressbook.h> #ifndef KORG_NODCOP #include <dcopclient.h> #include "korganizer.h" #include "koprefs.h" #include "actionmanager.h" #endif #include "koeventviewer.h" -#include "koeventviewer.moc" #ifndef KORG_NOKABC #include <kabc/stdaddressbook.h> #define size count #endif KOEventViewer::KOEventViewer(QWidget *parent,const char *name) : QTextBrowser(parent,name) { mSyncMode = false; mColorMode = 0; } KOEventViewer::~KOEventViewer() { } void KOEventViewer::setSource(const QString& n) { KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); KABC::AddressBook::Iterator it; for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { // LR I do not understand, why the uid string is different on zaurus and desktop #ifdef DESKTOP_VERSION QString uid = "uid://"+(*it).uid(); #else QString uid = "uid:"+(*it).uid(); #endif //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); if (n == uid ) { //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); QDialog dia( this,"dia123", true ); dia.setCaption( i18n("Details of attendee") ); QVBoxLayout lay ( &dia ); KPIM::AddresseeView av ( &dia ); av.setAddressee( (*it) ); lay.addWidget( &av ); if ( QApplication::desktop()->width() < 480 ) dia.resize( 220, 240); else { dia.resize( 400,400); } dia.exec(); break; } } #ifndef KORG_NODCOP kdDebug() << "KOEventViewer::setSource(): " << n << endl; QString tmpStr; if (n.startsWith("mailto:")) { KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); //emit showIncidence(n); return; } else if (n.startsWith("uid:")) { DCOPClient *client = KApplication::kApplication()->dcopClient(); const QByteArray noParamData; const QByteArray paramData; QByteArray replyData; QCString replyTypeStr; #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) bool foundAbbrowser = PING_ABBROWSER; if (foundAbbrowser) { //KAddressbook is already running, so just DCOP to it to bring up the contact editor //client->send("kaddressbook","KAddressBookIface", QDataStream arg(paramData, IO_WriteOnly); arg << n.mid(6); client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); return; } else { /* KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. We start it without its main interface */ KIconLoader* iconLoader = new KIconLoader(); QString iconPath = iconLoader->iconPath("go",KIcon::Small); ActionManager::setStartedKAddressBook(true); tmpStr = "kaddressbook --editor-only --uid "; tmpStr += KProcess::quote(n.mid(6)); KRun::runCommand(tmpStr,"KAddressBook",iconPath); return; } } else { //QTextBrowser::setSource(n); } #endif } void KOEventViewer::addTag(const QString & tag,const QString & text) { int number=text.contains("\n"); QString str = "<" + tag + ">"; QString tmpText=text; QString tmpStr=str; if(number !=-1) { if (number > 0) { int pos=0; QString tmp; for(int i=0;i<=number;i++) { pos=tmpText.find("\n"); tmp=tmpText.left(pos); tmpText=tmpText.right(tmpText.length()-pos-1); tmpStr+=tmp+"<br>"; } } else tmpStr += tmpText; tmpStr+="</" + tag + ">"; mText.append(tmpStr); } else { str += text + "</" + tag + ">"; mText.append(str); } } void KOEventViewer::setColorMode( int m ) { mColorMode = m; } void KOEventViewer::appendEvent(Event *event, int mode ) { mCurrentIncidence = event; bool shortDate = KOPrefs::instance()->mShortDateInViewer; topLevelWidget()->setCaption(i18n("Event Viewer")); if ( mode == 0 ) { diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 64ab94d..be183eb 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp @@ -1,159 +1,158 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <klocale.h> #include <libkcal/event.h> #include <qpushbutton.h> #include "koeventviewer.h" #include "koprefs.h" #include <libkcal/todo.h> #include "qapp.h" #include "koeventviewerdialog.h" -#include "koeventviewerdialog.moc" extern int globalFlagBlockAgenda; KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) : KDialogBase(parent,name, #ifndef DESKTOP_VERSION true , #else false, #endif i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) { mEventViewer = new KOEventViewer(this); mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); setMainWidget(mEventViewer); setButtonText(Ok, i18n("Edit") ); QObject::connect(findButton( Ok ),SIGNAL(clicked()), SLOT(editIncidence())); QObject::connect(this,SIGNAL(user1Clicked()), SLOT(showIncidence())); mIncidence = 0; // TODO: Set a sensible size (based on the content?). //showMaximized(); //qDebug("++++++++++++KOEventViewerDialog() "); // if ( KOPrefs::instance()->mCompactDialogs ) { // setFixedSize( 240,284 ); // move( 0, 15 ); // } else { // setMinimumSize(300,200); // resize(320,300); // } mSyncMode = false; mSyncResult = 0; } KOEventViewerDialog::~KOEventViewerDialog() { //qDebug("-------~KOEventViewerDialog() "); } void KOEventViewerDialog::showMe() { #ifdef DESKTOP_VERSION show(); #else showMaximized(); #endif setFocus(); setActiveWindow(); } void KOEventViewerDialog::setSyncMode( bool b ) { mSyncMode = b; //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); if ( mSyncMode ) { findButton( Close )->setText( i18n("Cancel Sync")); findButton( Ok )->setText( i18n("Remote")); findButton( User1 )->setText( i18n("Local")); } else { findButton( Close )->setText( i18n("Close")); findButton( Ok )->setText( i18n("Edit")); findButton( User1 )->setText( i18n("Agenda")); } mEventViewer->setSyncMode( b ); } void KOEventViewerDialog::setColorMode( int m ) { mEventViewer->setColorMode( m ); } int KOEventViewerDialog::executeS( bool local ) { mSyncResult = 3; if ( local ) findButton( User1 )->setFocus(); else findButton( Ok )->setFocus(); exec(); return mSyncResult; } void KOEventViewerDialog::updateConfig() { mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); } void KOEventViewerDialog::setEvent(Event *event) { mEventViewer->setEvent(event); mIncidence = event; findButton( Close )->setFocus(); } void KOEventViewerDialog::setIncidence(Incidence *in ) { if ( in->type() == "Event" ) setEvent( (Event*) in ); else if ( in->type() =="Todo" ) setTodo( (Todo*) in ); else if ( in->type() =="Journal" ) setJournal( (Journal*) in ); } void KOEventViewerDialog::addIncidence(Incidence *in) { if ( in->type() == "Event" ) addEvent( (Event*) in ); else if ( in->type() =="Todo" ) mEventViewer->setTodo( (Todo*) in, false ); else if ( in->type() =="Journal" ) mEventViewer->setJournal( (Journal*) in, false ); if ( mSyncMode ) { findButton( User1 )->setFocus(); setCaption(i18n("Conflict! Please choose entry")); } } void KOEventViewerDialog::addEvent(Event *event) { mEventViewer->addEvent(event); mIncidence = event; findButton( Close )->setFocus(); } void KOEventViewerDialog::setTodo(Todo *event) { mEventViewer->setTodo(event); mIncidence = (Incidence*)event; diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index b22bc54..1479208 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -1,96 +1,95 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qcheckbox.h> #include <qcombobox.h> #include <qpushbutton.h> #include <libkcal/calfilter.h> #include "kofilterview.h" -#include "kofilterview.moc" KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, const char* name,WFlags fl ) : KOFilterView_base(parent,name,fl) { mFilters = filterList; connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); } KOFilterView::~KOFilterView() { // no need to delete child widgets, Qt does it all for us } bool KOFilterView::filtersEnabled() { return mEnabledCheck->isChecked(); } void KOFilterView::setFiltersEnabled(bool set) { mEnabledCheck->setChecked(set); emit filterChanged(); } void KOFilterView::updateFilters() { mSelectionCombo->clear(); CalFilter *filter = mFilters->first(); while(filter) { mSelectionCombo->insertItem(filter->name()); filter = mFilters->next(); } } CalFilter *KOFilterView::selectedFilter() { CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); return f; } void KOFilterView::setSelectedFilter(QString filterName) { int filter_num = mSelectionCombo->count(); int i; for (i=0;i<filter_num;i++) { if (mSelectionCombo->text(i)==filterName) mSelectionCombo->setCurrentItem(i); } emit filterChanged(); } void KOFilterView::setSelectedFilter( int fil ) { if ( fil >= mSelectionCombo->count() ) return; mSelectionCombo->setCurrentItem( fil ); emit filterChanged(); } diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp index e10a188..51df123 100644 --- a/korganizer/koincidenceeditor.cpp +++ b/korganizer/koincidenceeditor.cpp @@ -1,176 +1,175 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qlayout.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qdir.h> #include <kdebug.h> #include <klocale.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <kfiledialog.h> #include <libkdepim/categoryselectdialog.h> #include <libkdepim/kinputdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include "koprefs.h" #include "koglobals.h" #include "koincidenceeditor.h" -#include "koincidenceeditor.moc" KOIncidenceEditor::KOIncidenceEditor( const QString &caption, Calendar *calendar, QWidget *parent ) : KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, parent, caption, true, false ), mSaveTemplateDialog( 0 ) { mCalendar = calendar; setButtonText( Default, i18n("Template...") ); QString saveTemplateText; // if ( KOPrefs::instance()->mCompactDialogs ) { // showButton( User1, false ); // showButton( Apply, false ); // } else { showButton( Apply, false ); saveTemplateText = i18n("Ok+Agenda"); // } setButtonText( User1, saveTemplateText ); //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); // KOGlobals::fitDialogToScreen( mCategoryDialog ); //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); } KOIncidenceEditor::~KOIncidenceEditor() { //delete mCategoryDialog; } void KOIncidenceEditor::setupAttendeesTab() { QFrame *topFrame = addPage(i18n("Attendees")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); mDetails = new KOEditorDetails(spacingHint(),topFrame); topLayout->addWidget(mDetails); } void KOIncidenceEditor::slotApply() { processInput( false ); } void KOIncidenceEditor::accept() { slotOk(); } void KOIncidenceEditor::slotOk() { if ( processInput( false ) ) QDialog::accept(); } void KOIncidenceEditor::updateCategoryConfig() { qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); //mCategoryDialog->updateCategoryConfig(); } void KOIncidenceEditor::slotCancel() { reject(); } void KOIncidenceEditor::slotLoadTemplate() { kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; } void KOIncidenceEditor::slotShowIncidence() { if ( processInput(true ) ) { accept(); } } void KOIncidenceEditor::slotSaveTemplate() { kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; } void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) { if ( !mSaveTemplateDialog ) { mSaveTemplateDialog = new SaveTemplateDialog( type, this ); connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), SLOT( saveTemplate( const QString & ) ) ); } mSaveTemplateDialog->show(); mSaveTemplateDialog->raise(); } void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, const QString &templateName ) { CalendarLocal cal; cal.addIncidence( incidence ); ICalFormat format; format.save( &cal, templateName ); } QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, const QStringList &templates ) { // bool ok = false; // QString templateName = KInputDialog::getItem( i18n("Load Template"), // i18n("Select a template to load:"), templates, 0, &ok ); // if ( !ok || templateName.isEmpty() ) return QString::null; // QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + // templateName ); // fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); // QString fileName;// =locateLocal( "templates", incidence->type() ); // fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); // if ( fileNamelength() == 0) // return QString::null; // if ( fileName.isEmpty() ) { // KMessageBox::error( this, i18n("Unable to find template '%1'.") // .arg( fileName ) ); // return QString::null; diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 579f24d..6e6a939 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -1,113 +1,112 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ // // View of Journal entries #include <qlayout.h> #include <qpopupmenu.h> #include <klocale.h> #include <kdebug.h> #include "koprefs.h" #include <libkcal/calendar.h> #include "journalentry.h" #include "kojournalview.h" using namespace KOrg; -#include "kojournalview.moc" KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, const char *name) : KOrg::BaseView(calendar, parent, name) { mEntry = new JournalEntry(calendar,this); mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(mEntry); connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; } KOJournalView::~KOJournalView() { } int KOJournalView::currentDateCount() { return 0; } QPtrList<Incidence> KOJournalView::selectedIncidences() { QPtrList<Incidence> eventList; return eventList; } void KOJournalView::updateConfig() { mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); } void KOJournalView::updateView() { mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); } void KOJournalView::flushView() { mEntry->flushEntry(); } void KOJournalView::showDates(const QDate &start, const QDate &) { // kdDebug() << "KOJournalView::selectDates()" << endl; mEntry->setDate(start); Journal *j = calendar()->journal(start); if (j) mEntry->setJournal(j); else mEntry->clear(); // emit incidenceSelected( 0 ); } void KOJournalView::showEvents(QPtrList<Event>) { // After new creation of list view no events are selected. // emit incidenceSelected( 0 ); } void KOJournalView::changeEventDisplay(Event *, int /*action*/) { updateView(); } void KOJournalView::keyPressEvent ( QKeyEvent * e ) { //qDebug("keyPressEven "); if ( e->state() == Qt::ControlButton ) { if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) e->ignore(); } } diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index b6061d0..9a3ba73 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -1,190 +1,189 @@ /* This file is part of KOrganizer. Copyright (c) 1999 Preston Brown Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlistview.h> #include <qlayout.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qprogressbar.h> #include <qfileinfo.h> #include <qmessagebox.h> #include <qdialog.h> #include <qtextstream.h> #include <qdir.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <kglobal.h> #include <libkcal/calendar.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include <libkcal/vcalformat.h> #include <libkcal/recurrence.h> #include <libkcal/filestorage.h> #include <libkdepim/categoryselectdialog.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "koglobals.h" #include "koprefs.h" #include "kfiledialog.h" #include "kolistview.h" -#include "kolistview.moc" ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) { mItem = item; mDate = date; } ListItemVisitor::~ListItemVisitor() { } bool ListItemVisitor::visit(Event *e) { bool ok = false; QString start, end; if ( e->doesRecur() ) { QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); if ( ok ) { int days = e->dtStart().date().daysTo(e->dtEnd().date() ); start = KGlobal::locale()->formatDate(d,true); end = KGlobal::locale()->formatDate(d.addDays( days),true); } } if ( ! ok ) { start =e->dtStartDateStr(); end = e->dtEndDateStr(); } mItem->setText(0,e->summary()); mItem->setText(1,start); mItem->setText(2,e->dtStartTimeStr()); mItem->setText(3,end); mItem->setText(4,e->dtEndTimeStr()); mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); mItem->setText(6, e->recurrence()->recurrenceText()); mItem->setText(7,"---"); mItem->setText(8,"---"); mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,e->categoriesStr()); QString key; QDate d = e->dtStart().date(); QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); mItem->setSortKey(1,key); d = e->dtEnd().date(); t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); mItem->setSortKey(3,key); return true; } bool ListItemVisitor::visit(Todo *t) { mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); if (t->hasStartDate()) { mItem->setText(1,t->dtStartDateStr()); if (t->doesFloat()) { mItem->setText(2,"---"); } else { mItem->setText(2,t->dtStartTimeStr()); } } else { mItem->setText(1,"---"); mItem->setText(2,"---"); } mItem->setText(3,"---"); mItem->setText(4,"---"); mItem->setText(5,"---"); mItem->setText(6,"---"); if (t->hasDueDate()) { mItem->setText(7,t->dtDueDateStr()); if (t->doesFloat()) { mItem->setText(8,"---"); } else { mItem->setText(8,t->dtDueTimeStr()); } } else { mItem->setText(7,"---"); mItem->setText(8,"---"); } mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,t->categoriesStr()); QString key; QDate d; if (t->hasDueDate()) { d = t->dtDue().date(); QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); mItem->setSortKey(7,key); } if ( t->hasStartDate() ) { d = t->dtStart().date(); QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); mItem->setSortKey(1,key); } return true; } bool ListItemVisitor::visit(Journal * j) { mItem->setText(0,i18n("Journal")); mItem->setText(1,j->dtStartDateStr()); mItem->setText(2,"---"); mItem->setText(3,"---"); mItem->setText(4,"---"); mItem->setText(5,"---"); mItem->setText(6,"---"); mItem->setText(7,j->dtStartDateStr()); mItem->setText(8,"---"); mItem->setText(9,"---"); QString key; QDate d = j->dtStart().date(); key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); mItem->setSortKey(1,key); mItem->setSortKey(7,key); return true; } KOListView::KOListView(Calendar *calendar, QWidget *parent, const char *name) diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index c4bc51b..df60564 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1,183 +1,182 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qpopupmenu.h> #include <qfont.h> #include <qfontmetrics.h> #include <qkeycode.h> #include <qhbox.h> #include <qvbox.h> #include <qpushbutton.h> #include <qtooltip.h> #include <qpainter.h> #include <qwhatsthis.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kconfig.h> #include <kiconloader.h> #include <kcalendarsystem.h> #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "koprefs.h" #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include "koglobals.h" #include <libkdepim/kincidenceformatter.h> #include "komonthview.h" -#include "komonthview.moc" #define PIXMAP_SIZE 5 class KNOWhatsThis :public QWhatsThis { public: KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; protected: virtual QString text( const QPoint& p) { return _wid->getWhatsThisText(p) ; }; private: KNoScrollListBox* _wid; }; KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) : QListBox(parent, name) { #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif new KNOWhatsThis(this); } QString KNoScrollListBox::getWhatsThisText(QPoint p) { QListBoxItem* item = itemAt ( p ); if ( ! item ) { return i18n("Click in the cell or\non the date label\nto add an event!"); } return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); } void KNoScrollListBox::keyPressEvent(QKeyEvent *e) { switch(e->key()) { case Key_Right: // if ( e->state() == Qt::ControlButton ) { e->ignore(); return; } scrollBy(4,0); break; case Key_Left: // if ( e->state() == Qt::ControlButton ) { e->ignore(); return; } scrollBy(-4,0); break; case Key_Up: if(!count()) break; setCurrentItem((currentItem()+count()-1)%count()); if(!itemVisible(currentItem())) { if((unsigned int) currentItem() == (count()-1)) { setTopItem(currentItem()-numItemsVisible()+1); } else { setTopItem(topItem()-1); } } break; case Key_Down: if(!count()) break; setCurrentItem((currentItem()+1)%count()); if(!itemVisible(currentItem())) { if(currentItem() == 0) { setTopItem(0); } else { setTopItem(topItem()+1); } } break; case Key_Shift: emit shiftDown(); break; default: e->ignore(); break; } } void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) { switch(e->key()) { case Key_Shift: emit shiftUp(); break; default: break; } } void KNoScrollListBox::mousePressEvent(QMouseEvent *e) { QListBox::mousePressEvent(e); if(e->button() == RightButton) { emit rightClick(); } } MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) : QListBoxItem() { setText( s ); mIncidence = incidence; mDate = qd; // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); mRecur = false; mAlarm = false; mReply = false; mInfo = false; } void MonthViewItem::paint(QPainter *p) { #if QT_VERSION >= 0x030000 bool sel = isSelected(); #else bool sel = selected(); #endif diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 04fffe2..da6644f 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp @@ -1,198 +1,197 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qlabel.h> #include <qgroupbox.h> #include <qbuttongroup.h> #include <qlineedit.h> #include <qfont.h> #include <qslider.h> #include <qfile.h> #include <qtextstream.h> #include <qcombobox.h> #include <qvbox.h> #include <qhbox.h> #include <qregexp.h> #include <qspinbox.h> #include <qdatetime.h> #include <qcheckbox.h> #include <qradiobutton.h> #include <qpushbutton.h> #include <qstrlist.h> #include <qapplication.h> #include <kcolorbutton.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kfontdialog.h> #include <kfiledialog.h> #include <kmessagebox.h> #include <kcolordialog.h> #include <kiconloader.h> #include <kemailsettings.h> #include <kstandarddirs.h> #include <kurlrequester.h> #include <klineedit.h> #if defined(USE_SOLARIS) #include <sys/param.h> #define ZONEINFODIR "/usr/share/lib/zoneinfo" #define INITFILE "/etc/default/init" #endif #include "koprefs.h" #include "koprefsdialog.h" -#include "koprefsdialog.moc" KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : KPrefsDialog(KOPrefs::instance(),parent,name,true) { setCaption( i18n("Preferences - some settings need a restart (nr)")); mCategoryDict.setAutoDelete(true); KGlobal::locale()->insertCatalogue("timezones"); setupMainTab(); setupLocaleTab(); setupTimeZoneTab(); setupTimeTab(); setupLocaleDateTab(); setupFontsTab(); setupColorsTab(); setupViewsTab(); //setupSyncTab(); //setupSyncAlgTab(); //setupPrinterTab(); //setupGroupSchedulingTab(); //setupGroupAutomationTab(); } KOPrefsDialog::~KOPrefsDialog() { } void KOPrefsDialog::setupLocaleDateTab() { QFrame *topFrame = addPage(i18n("Date Format"),0,0); QGridLayout *topLayout = new QGridLayout(topFrame,3,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); int iii = 0; KPrefsWidRadios *syncPrefsGroup = addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); QString format; if ( QApplication::desktop()->width() < 480 ) format = "(%d.%m.%Y)"; else format = "(%d.%m.%Y|%A %d %B %Y)"; syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); if ( QApplication::desktop()->width() < 480 ) format = "(%m.%d.%Y)"; else format = "(%m.%d.%Y|%A %B %d %Y)"; syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); if ( QApplication::desktop()->width() < 480 ) format = "(%Y-%m-%d)"; else format = "(%Y-%m-%d|%A %Y %B %d)"; syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); syncPrefsGroup->addRadio(i18n("User defined")); topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); ++iii; ++iii; QLabel * lab; mUserDateFormatLong = new QLineEdit(topFrame); lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mUserDateFormatLong,iii,1); ++iii; mUserDateFormatShort = new QLineEdit(topFrame); lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mUserDateFormatShort,iii,1); ++iii; lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; } void KOPrefsDialog::setupLocaleTab() { QFrame *topFrame = addPage(i18n("Locale"),0,0); QGridLayout *topLayout = new QGridLayout(topFrame,4,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); int iii = 0; KPrefsWidRadios *syncPrefsGroup = addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); syncPrefsGroup->addRadio(i18n("English")); syncPrefsGroup->addRadio(i18n("German")); syncPrefsGroup->addRadio(i18n("French(nyi)")); syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); if ( QApplication::desktop()->width() < 300 ) ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); ++iii; syncPrefsGroup = addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); if ( QApplication::desktop()->width() > 300 ) syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); syncPrefsGroup->addRadio(i18n("24:00")); syncPrefsGroup->addRadio(i18n("12:00am")); syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); ++iii; KPrefsWidBool *sb; if ( QApplication::desktop()->width() < 300 ) { sb = addWidBool(i18n("Week starts on Sunday"), &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); ++iii; sb = addWidBool(i18n("Use short date in (WN/E) view"), &(KOPrefs::instance()->mShortDateInViewer),topFrame); topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); } else { QWidget * hb = new QWidget( topFrame ); QHBoxLayout *hbLayout = new QHBoxLayout(hb); sb = diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp index 2e051f2..b7e4265 100644 --- a/korganizer/kosyncprefsdialog.cpp +++ b/korganizer/kosyncprefsdialog.cpp @@ -1,194 +1,193 @@ /* This file is part of KOrganizer. Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qlabel.h> #include <qgroupbox.h> #include <qbuttongroup.h> #include <qlineedit.h> #include <qfont.h> #include <qslider.h> #include <qfile.h> #include <qtextstream.h> #include <qcombobox.h> #include <qvbox.h> #include <qhbox.h> #include <qspinbox.h> #include <qdatetime.h> #include <qcheckbox.h> #include <qradiobutton.h> #include <qpushbutton.h> #include <qstrlist.h> #include <qapplication.h> #include <kcolorbutton.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kfontdialog.h> #include <kmessagebox.h> #include <kcolordialog.h> #include <kiconloader.h> #include <kemailsettings.h> #include <kstandarddirs.h> #include <kfiledialog.h> #include <kmessagebox.h> #include <kurlrequester.h> #include <klineedit.h> #include <libkdepim/ksyncprofile.h> #include "koprefs.h" #include "kosyncprefsdialog.h" #include "koglobals.h" -#include "kosyncprefsdialog.moc" KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) : KDialog(parent,name,true) { setCaption( i18n("Synchronization Preferences")); mSyncProfiles.setAutoDelete( true ); setupSyncAlgTab(); } KOSyncPrefsDialog::~KOSyncPrefsDialog() { } #include <qlayout.h> #include <qscrollview.h> void KOSyncPrefsDialog::setupSyncAlgTab() { QLabel * lab; //QFrame *page = addPage(i18n("Sync Prefs"),0,0); QVBox * mainbox = new QVBox( this ); QScrollView* sv = new QScrollView( mainbox ); QHBoxLayout * lay = new QHBoxLayout( this ); lay->addWidget( mainbox ); QHBox * b_box = new QHBox( mainbox ); QPushButton* button = new QPushButton( i18n("Ok"), b_box ); connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); button = new QPushButton( i18n("Cancel"), b_box ); connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); //QBoxLayout * sl = new QVBoxLayout(this ); //sl->addWidget ( sv ); sv->setResizePolicy ( QScrollView::AutoOneFit ); QFrame *topFrame = new QFrame ( sv ); sv->addChild( topFrame ); mSetupSyncAlgTab = topFrame; QGridLayout *topLayout = new QGridLayout(topFrame,6,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); int iii = 0; //topLayout->addMultiCellWidget(lab , iii,iii,0,1); //++iii; mMyMachineName = new QLineEdit(topFrame); lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mMyMachineName,iii,1); ++iii; QHBox* buttonbox = new QHBox( topFrame); topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); ++iii; button = new QPushButton( i18n("New profile"), buttonbox ); connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); button = new QPushButton( i18n("Clone profile"), buttonbox ); connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); button = new QPushButton( i18n("Delete profile"), buttonbox ); connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); mProfileBox = new QComboBox(topFrame); mProfileBox->setEditable ( true ); connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mProfileBox, iii,1); ++iii; mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame ); topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); ++iii; mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); ++iii; QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); topLayout->addMultiCellWidget(gr, iii,iii,0,1); ++iii; loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); // both = new QRadioButton ( i18n("Take both on conflict"), gr ); mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); ++iii; mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); ++iii; mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); ++iii; proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); gr = proGr; topLayout->addMultiCellWidget(gr, iii,iii,0,1); ++iii; mIsLocal = new QRadioButton ( i18n("Local file"), gr ); mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); localFileWidget = new QVBox( topFrame); topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); ++iii; QHBox* temphb = new QHBox( localFileWidget ); lab = new QLabel( i18n("Local file:"), temphb); mRemoteFile = new QLineEdit(localFileWidget); button = new QPushButton( i18n("Choose..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); remoteFileWidget = new QVBox( topFrame); topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); ++iii; diff --git a/korganizer/kotimespanview.cpp b/korganizer/kotimespanview.cpp index 266a403..3265a3a 100644 --- a/korganizer/kotimespanview.cpp +++ b/korganizer/kotimespanview.cpp @@ -1,110 +1,109 @@ #include <qlayout.h> #include <kconfig.h> #include "timespanview.h" #include "koglobals.h" #include "kotimespanview.h" -#include "kotimespanview.moc" KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent, const char *name) : KOEventView( calendar, parent, name ) { QBoxLayout *topLayout = new QVBoxLayout( this ); mTimeSpanView = new TimeSpanView( this ); topLayout->addWidget( mTimeSpanView ); connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) ); } KOTimeSpanView::~KOTimeSpanView() { } void KOTimeSpanView::readSettings() { readSettings(KOGlobals::config()); } void KOTimeSpanView::readSettings(KConfig *config) { // kdDebug() << "KOTimeSpanView::readSettings()" << endl; config->setGroup("Views"); QValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView"); if (sizes.count() == 2) { mTimeSpanView->setSplitterSizes(sizes); } } void KOTimeSpanView::writeSettings(KConfig *config) { // kdDebug() << "KOTimeSpanView::writeSettings()" << endl; config->setGroup("Views"); QValueList<int> list = mTimeSpanView->splitterSizes(); config->writeEntry("Separator TimeSpanView",list); } int KOTimeSpanView::maxDatesHint() { return 0; } int KOTimeSpanView::currentDateCount() { return 0; } QPtrList<Incidence> KOTimeSpanView::selectedIncidences() { QPtrList<Incidence> selected; return selected; } void KOTimeSpanView::updateView() { insertItems( mTimeSpanView->startDateTime().date(), mTimeSpanView->endDateTime().date() ); } void KOTimeSpanView::showDates(const QDate &start, const QDate &end) { QDate s = start.addDays( -2 ); QDate e = end.addDays( 2 ); insertItems( s, e ); } void KOTimeSpanView::insertItems(const QDate &start, const QDate &end) { mTimeSpanView->clear(); mTimeSpanView->setDateRange( start, end ); QPtrList<Event> events = calendar()->events( start, end ); Event *event = events.first(); while( event ) { // kdDebug() << "KOTimeSpanView::showDates() add event: " << event->summary() // << endl; mTimeSpanView->addItem( event ); event = events.next(); } mTimeSpanView->updateView(); } void KOTimeSpanView::showEvents(QPtrList<Event> eventList) { } void KOTimeSpanView::changeEventDisplay(Event *, int) { } diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 1c44f2b..abeb068 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp @@ -1,178 +1,177 @@ /* This file is part of KOrganizer. Copyright (c) 1997, 1998 Preston Brown Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qlayout.h> #include <qhbox.h> #include <qdir.h> #include <qdatetime.h> #include <qapplication.h> #include <kiconloader.h> #include <klocale.h> #include <kfiledialog.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <libkdepim/categoryselectdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <libkcal/icalformat.h> #include <kresources/resourceselectdialog.h> #include "koprefs.h" #include "kotodoeditor.h" -#include "kotodoeditor.moc" extern int globalFlagBlockAgenda; KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) { mTodo = 0; mRelatedTodo = 0; findButton(User1)->hide(); init(); } KOTodoEditor::~KOTodoEditor() { emit dialogClose( mTodo ); } void KOTodoEditor::init() { setupGeneral(); setupAttendeesTab(); } void KOTodoEditor::setCategories( QString s ) { mGeneral->setCategories(s); } void KOTodoEditor::setSecrecy( int sec ) { mGeneral->setSecrecy( sec ); } void KOTodoEditor::reload() { if ( mTodo ) readTodo( mTodo ); } void KOTodoEditor::setupGeneral() { mGeneral = new KOEditorGeneralTodo(this); connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), // mGeneral,SLOT(setCategories(const QString &))); if (KOPrefs::instance()->mCompactDialogs) { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); if ( QApplication::desktop()->width() < 480 ) { topLayout->setMargin(1); topLayout->setSpacing(1); } else { topLayout->setMargin(marginHint()-1); topLayout->setSpacing(spacingHint()-1); } mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); mGeneral->initAlarm(topFrame,topLayout); mGeneral->enableAlarm( false ); QBoxLayout *priorityLayout; if ( QApplication::desktop()->width() < 500 ) priorityLayout = new QVBoxLayout( topLayout ); else priorityLayout = new QHBoxLayout( topLayout ); QWidget* prioWidget = new QWidget (topFrame); priorityLayout->addWidget( prioWidget ); QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); QIconSet icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else icon = SmallIcon("fileexport"); QPushButton * saveTemplate = new QPushButton( prioWidget); saveTemplate->setIconSet (icon ) ; int size = saveTemplate->sizeHint().height(); saveTemplate->setFixedSize( size, size ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); else icon = SmallIcon("fileimport"); QPushButton * loadTemplate = new QPushButton( prioWidget); loadTemplate->setIconSet (icon ) ; loadTemplate->setFixedSize( size, size ); priorityLayout2->addWidget(loadTemplate); priorityLayout2->addWidget(saveTemplate); mGeneral->initPriority(prioWidget,priorityLayout2); mGeneral->initCategories( topFrame, priorityLayout ); topLayout->addStretch(1); QFrame *topFrame2 = addPage(i18n("Details")); QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); topLayout2->setMargin(marginHint()); topLayout2->setSpacing(spacingHint()); QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); mGeneral->initCompletion(topFrame2,completionLayout); mGeneral->initSecrecy( topFrame2, topLayout2 ); mGeneral->initDescription(topFrame2,topLayout2); // QHBox * hb = new QHBox ( topFrame2 ); // topLayout2->addWidget(hb); // hb->setSpacing( 3 ); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); } else { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); topLayout->setSpacing(spacingHint()); mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); mGeneral->initStatus(topFrame,topLayout); QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); mGeneral->initAlarm(topFrame,alarmLineLayout); mGeneral->initDescription(topFrame,topLayout); QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); mGeneral->initCategories( topFrame, detailsLayout ); mGeneral->initSecrecy( topFrame, detailsLayout ); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0708a69..d9e0a03 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -1,183 +1,182 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qheader.h> #include <qcursor.h> #include <qvbox.h> #include <kdebug.h> #include "koprefs.h" #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include <kmessagebox.h> #include <libkcal/icaldrag.h> #include <libkcal/vcaldrag.h> #include <libkcal/calfilter.h> #include <libkcal/dndfactory.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "docprefs.h" #include "kotodoview.h" using namespace KOrg; -#include "kotodoview.moc" KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, const char *name) : KListView(parent,name) { mCalendar = calendar; #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); #endif mOldCurrent = 0; mMousePressed = false; setAcceptDrops(true); viewport()->setAcceptDrops(true); int size = 16; if (qApp->desktop()->width() < 300 ) size = 12; setTreeStepSize( size + 6 ); } void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } mOldCurrent = currentItem(); #endif } void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } e->accept(); #endif } void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; setCurrentItem(mOldCurrent); setSelected(mOldCurrent,true); #endif } void KOTodoListView::contentsDropEvent(QDropEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } DndFactory factory( mCalendar ); Todo *todo = factory.createDropTodo(e); if (todo) { e->acceptAction(); KOTodoViewItem *destination = (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); Todo *destinationEvent = 0; if (destination) destinationEvent = destination->todo(); Todo *existingTodo = mCalendar->todo(todo->uid()); if(existingTodo) { // kdDebug() << "Drop existing Todo" << endl; Incidence *to = destinationEvent; while(to) { if (to->uid() == todo->uid()) { KMessageBox::sorry(this, i18n("Cannot move To-Do to itself or a child of itself"), i18n("Drop To-Do")); delete todo; return; } to = to->relatedTo(); } existingTodo->setRelatedTo(destinationEvent); emit todoDropped(todo); delete todo; } else { // kdDebug() << "Drop new Todo" << endl; todo->setRelatedTo(destinationEvent); mCalendar->addTodo(todo); emit todoDropped(todo); } } else { QString text; if (QTextDrag::decode(e,text)) { //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); kdDebug() << "Dropped : " << text << endl; QStringList emails = QStringList::split(",",text); for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { kdDebug() << " Email: " << (*it) << endl; int pos = (*it).find("<"); QString name = (*it).left(pos); QString email = (*it).mid(pos); if (!email.isEmpty() && todoi) { todoi->todo()->addAttendee(new Attendee(name,email)); } } } else { kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 88d69c6..fc2bc77 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -1,177 +1,176 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qwidgetstack.h> #include <kconfig.h> #include <kglobal.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #include "calendarview.h" #include "datenavigator.h" #include "kotodoview.h" #include "koagendaview.h" #include "kodialogmanager.h" #include "komonthview.h" #include "kolistview.h" #include "kowhatsnextview.h" #include "kojournalview.h" #include "kotimespanview.h" #include "koprefs.h" #include "navigatorbar.h" #include "koviewmanager.h" -#include "koviewmanager.moc" //extern bool externFlagMonthviewBlockPainting; //bool globalFlagBlockPainting = false; int globalFlagBlockAgenda = 0; int globalFlagBlockLabel = 0; int globalFlagBlockAgendaItemPaint = 1; int globalFlagBlockAgendaItemUpdate = 1; KOViewManager::KOViewManager( CalendarView *mainView ) : QObject(), mMainView( mainView ) { mCurrentView = 0; mWhatsNextView = 0; mTodoView = 0; mAgendaView = 0; mMonthView = 0; mListView = 0; mJournalView = 0; mTimeSpanView = 0; mCurrentAgendaView = 0 ; mFlagShowNextxDays = false; } KOViewManager::~KOViewManager() { } KOrg::BaseView *KOViewManager::currentView() { return mCurrentView; } void KOViewManager::readSettings(KConfig *config) { config->setGroup("General"); QString view = config->readEntry("Current View"); if (view == "WhatsNext") showWhatsNextView(); else if (view == "Month") showMonthView(); else if (view == "List") showListView(); else if (view == "Journal") showJournalView(); else if (view == "TimeSpan") showTimeSpanView(); else if (view == "Todo") showTodoView(); else { showAgendaView(); } } void KOViewManager::writeSettings(KConfig *config) { config->setGroup("General"); QString view; if (mCurrentView == mWhatsNextView) view = "WhatsNext"; else if (mCurrentView == mMonthView) view = "Month"; else if (mCurrentView == mListView) view = "List"; else if (mCurrentView == mJournalView) view = "Journal"; else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; else if (mCurrentView == mTodoView) view = "Todo"; else view = "Agenda"; config->writeEntry("Current View",view); if (mAgendaView) { mAgendaView->writeSettings(config); } if (mTimeSpanView) { mTimeSpanView->writeSettings(config); } if (mListView) { mListView->writeSettings(config); } if (mTodoView) { mTodoView->saveLayout(config,"Todo View"); } } void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) { //mFlagShowNextxDays = false; //if(view == mCurrentView) return; if ( view == 0 ) { view = mCurrentView; if ( view == 0 ) return; } bool full = fullScreen; if(view == mCurrentView && view != mWhatsNextView ) { if ( mCurrentAgendaView < 0 ) return; full = mMainView->leftFrame()->isVisible(); } else { mCurrentView = view; // bool full = fullScreen; bool isFull = !mMainView->leftFrame()->isVisible(); if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) full = true; if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) full = false; } if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); raiseCurrentView( full ); mMainView->processIncidenceSelection( 0 ); mMainView->updateView(); mMainView->adaptNavigationUnits(); } void KOViewManager::raiseCurrentView( bool fullScreen ) { //qDebug("raiseCurrentView "); mCurrentAgendaView = 0; int wid = mMainView->width() ; int hei = mMainView->height(); if ( mCurrentView == mMonthView ) { mMainView->navigatorBar()->show(); hei -= mMainView->navigatorBar()->sizeHint().height(); //mMainView->navigatorBar()->hide(); } else { mMainView->navigatorBar()->hide(); } if ( fullScreen ) { mMainView->leftFrame()->hide(); } else { mMainView->leftFrame()->show(); diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index ffaea37..0547a2e 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -1,173 +1,172 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlayout.h> #include <qtextbrowser.h> #include <qtextcodec.h> #include <qfileinfo.h> #include <qlabel.h> #include <qapplication.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <kmessagebox.h> #include <libkcal/calendar.h> #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "koglobals.h" #include "koprefs.h" #include "koeventviewerdialog.h" #include "kowhatsnextview.h" using namespace KOrg; -#include "kowhatsnextview.moc" void WhatsNextTextBrowser::setSource(const QString& n) { if (n.startsWith("event:")) { emit showIncidence(n); return; } else if (n.startsWith("todo:")) { emit showIncidence(n); return; } else { QTextBrowser::setSource(n); } } KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, const char *name) : KOrg::BaseView(calendar, parent, name) { // mDateLabel = // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); // mDateLabel->setMargin(2); // mDateLabel->setAlignment(AlignCenter); setFont( KOPrefs::instance()->mWhatsNextFont ); mView = new WhatsNextTextBrowser(this); connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); mEventViewer = 0; QBoxLayout *topLayout = new QVBoxLayout(this); // topLayout->addWidget(mDateLabel); topLayout->addWidget(mView); } KOWhatsNextView::~KOWhatsNextView() { } int KOWhatsNextView::maxDatesHint() { return 0; } int KOWhatsNextView::currentDateCount() { return 0; } QPtrList<Incidence> KOWhatsNextView::selectedIncidences() { QPtrList<Incidence> eventList; return eventList; } void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Day, fd, td); #endif } void KOWhatsNextView::updateConfig() { setFont( KOPrefs::instance()->mWhatsNextFont ); updateView(); } void KOWhatsNextView::updateView() { // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); KIconLoader kil("korganizer"); QString ipath;// = new QString(); // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); //<big><big><strong>" + date + "</strong></big></big>\n"; mText = "<table width=\"100%\">\n"; //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; #ifdef DESKTOP_VERSION mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; #else mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; #endif // mText += "<img src=\""; // mText += ipath; // mText += "\">"; mEventDate = QDate::currentDate(); #ifdef DESKTOP_VERSION mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; #else mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; #endif mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; int iii; mTodos.clear(); QPtrList<Event> events; QPtrList<Todo> todos = calendar()->todos(); Todo * todo; //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; int daysToShow = KOPrefs::instance()->mWhatsNextDays ; bool itemAdded = false; for ( iii = 0; iii < daysToShow; ++iii ) { QString date; itemAdded = false; events = calendar()->events( mEventDate, true ); if ( iii == 0 ) { // today !!! todo = todos.first(); while(todo) { if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { if ( ! itemAdded ) { appendDay ( iii, mEventDate ); itemAdded = true; } appendEvent(todo); } todo = todos.next(); } } if (events.count() > 0) { // mText += "<p></p>"; // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); // mText += "<h2>"; //mText += " <img src=\""; diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index f9720f6..cf07a1a 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp @@ -1,166 +1,165 @@ /* This file is part of KOrganizer. Copyright (c) 1999 Preston Brown, Ian Dawes This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qkeycode.h> #include <qcombobox.h> #include <qdatetime.h> #include <qlineedit.h> #include <qapplication.h> #include <kmessagebox.h> #include <kglobal.h> #include <kdebug.h> #include <klocale.h> #include "ktimeedit.h" #include "koprefs.h" #include <qvalidator.h> -#include "ktimeedit.moc" // Validator for a time value with only hours and minutes (no seconds) // Mostly locale aware. Author: David Faure <faure@kde.org> class KOTimeValidator : public QValidator { public: KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} virtual State validate(QString& str, int& /*cursorPos*/) const { return Acceptable; bool ok = false; // TODO use KLocale::WithoutSeconds in HEAD /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); if ( ok ) return Acceptable; // readTime doesn't help knowing when the string is "Intermediate". int length = str.length(); if ( !str ) // empty string? return Invalid; // there should always be a ':' in it, right? // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...) QChar sep = ':'; // I want to allow "HH:", ":MM" and ":" to make editing easier if ( str[0] == sep ) { if ( length == 1 ) // just ":" return Intermediate; QString minutes = str.mid(1); int m = minutes.toInt(&ok); if ( ok && m >= 0 && m < 60 ) return Intermediate; } else if ( str.at(str.length()-1) == sep ) { QString hours = str.left(length-1); int h = hours.toInt(&ok); if ( ok && h >= 0 && h < 24 ) return Intermediate; } return Invalid; } }; // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. // Difficult to get all in one... // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) : QComboBox(TRUE, parent, name) { setInsertionPolicy(NoInsertion); setValidator( new KOTimeValidator( this ) ); mFlagKeyPressed = false; if ( QApplication::desktop()->width() < 650 ) setSizeLimit ( 6 ); mTime = qt; // mNoTimeString = i18n("No Time"); // insertItem( mNoTimeString ); // Fill combo box with selection of times in localized format. QTime timeEntry(0,0,0); do { insertItem(KGlobal::locale()->formatTime(timeEntry)); timeEntry = timeEntry.addSecs(60*15); } while (!timeEntry.isNull()); // Add end of day. insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); updateText(); setFocusPolicy(QWidget::StrongFocus); connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); QFontMetrics fm ( font() ); QString timeString = "24:00"; if ( KOPrefs::instance()->mPreferredTime == 1 ) timeString = "02:00pm"; int addSpace = 32; if ( QApplication::desktop()->width() > 320 ) timeString += ":00"; setFixedWidth(fm.width( timeString ) + 32 ); // Highlight Background and Textcolor change from default QPalette palette = QWidget::palette(); unsigned char red, green, blue; red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); setPalette( palette ); } KOTimeEdit::~KOTimeEdit() { } bool KOTimeEdit::hasTime() const { // Can't happen if ( currentText().isEmpty() ) return false; //if ( currentText() == mNoTimeString ) return false; return true; // always } QTime KOTimeEdit::getTime() const { //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl; // TODO use KLocale::WithoutSeconds in HEAD QTime time = KGlobal::locale()->readTime(currentText()); // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl; return time; } /* QSizePolicy KOTimeEdit::sizePolicy() const { // Set size policy to Fixed, because edit cannot contain more text than the // string representing the time. It doesn't make sense to provide more space. QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); return sizePolicy; } */ void KOTimeEdit::setTime(QTime newTime) { if ( mTime != newTime ) diff --git a/korganizer/lineview.cpp b/korganizer/lineview.cpp index f1ff29f..e72e41c 100644 --- a/korganizer/lineview.cpp +++ b/korganizer/lineview.cpp @@ -1,94 +1,93 @@ #include <qpainter.h> #include <kdebug.h> #include "koprefs.h" #include "lineview.h" -#include "lineview.moc" LineView::LineView( QWidget *parent, const char *name ) : QScrollView( parent, name ) { mPixelWidth = 1000; mLines.setAutoDelete( true ); resizeContents( mPixelWidth, contentsHeight() ); viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); } LineView::~LineView() { } int LineView::pixelWidth() { return mPixelWidth; } void LineView::addLine( int start, int end ) { int count = mLines.count(); if( start < 0 ) start = 0; if( end > mPixelWidth) end = mPixelWidth; kdDebug() << "LineView::addLine() col: " << count << " start: " << start << " end: " << end << endl; mLines.append( new Line( count, start, end ) ); } void LineView::clear() { mLines.clear(); update(); } void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { // kdDebug() << "LineView::drawContents()" << endl; int mGridSpacingX = 10; int mGridSpacingY = 20; #if 0 // Draw vertical lines of grid // kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; while (x < cx + cw) { p->drawLine(x,cy,x,cy+ch); x+=mGridSpacingX; } #endif // Draw horizontal lines of grid int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10; while (y < cy + ch) { // kdDebug() << " y: " << y << endl; p->drawLine(cx,y,cx+cw,y); y+=mGridSpacingY; } Line *line; for( line = mLines.first(); line; line = mLines.next() ) { int ctop = line->column * 20 + 10 - 5; int cbottom = line->column * 20 + 10 + 5; int s = line->start; int e = line->end; // kdDebug() << " LineView::drawContents(): ctop: " << ctop << " cbottom: " // << cbottom << " s: " << s << " e: " << e << endl; if ( ctop <= (cy+ch) && cbottom >= cy && s <= (cx+cw) && e >= cx ) { if ( s < cx ) s = cx; if ( e > (cx+cw) ) e = cx+cw; if ( ctop < cy ) ctop = cy; if ( cbottom > (cy+ch) ) cbottom = cy+ch; // kdDebug() << " drawContents(): ctop: " << ctop << " cbottom: " // << cbottom << " s: " << s << " e: " << e << endl; p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") ); } } } diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 1052a99..f339c67 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -71,129 +71,128 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam #else bool isDesktop = true; #endif if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) isDesktop = true; // Create backward navigation buttons mPrevYear = new QPushButton( mCtrlFrame ); mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); QToolTip::add( mPrevYear, i18n("Previous Year") ); mPrevMonth = new QPushButton( mCtrlFrame ); mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); QToolTip::add( mPrevMonth, i18n("Previous Month") ); // Create forward navigation buttons mNextMonth = new QPushButton( mCtrlFrame ); mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); QToolTip::add( mNextMonth, i18n("Next Month") ); mNextYear = new QPushButton( mCtrlFrame ); mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); QToolTip::add( mNextYear, i18n("Next Year") ); mSelectMonth = new QPushButton( mCtrlFrame ); // Create month name label //selectMonth->setFont( tfont ); // selectMonth->setAlignment( AlignCenter ); //mDateLabel = new QLabel( selectMonth ); //mDateLabel->setFont( tfont ); //mDateLabel->setAlignment( AlignCenter ); if ( QString ( name ) == QString("useBigPixmaps") ) { mNextMonth->setFlat( true); mNextYear->setFlat( true); mSelectMonth->setFlat( true); mPrevYear->setFlat( true); mPrevMonth->setFlat( true); } mSelectMonth->setFont( tfont ); // Set minimum width to width of widest month name label int i; int maxwidth = 0; QFontMetrics fm ( mSelectMonth->font() ); int width = fm.width("September '00" ); // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); // ++i ) { // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); // int width = fm.width("September 2000" ); // if ( width > maxwidth ) maxwidth = width; // } maxwidth = width+2; int size = fm.height()+2; if ( QApplication::desktop()->width() >= 480 ) { size += 6; maxwidth+= 6; } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); mNextMonth->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); // set up control frame layout QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); ctrlLayout->addWidget( mSelectMonth ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); mPrevYear->setFocusPolicy(NoFocus); mPrevMonth->setFocusPolicy(NoFocus); mNextMonth->setFocusPolicy(NoFocus); mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); } NavigatorBar::~NavigatorBar() { } void NavigatorBar::selectMonth() { int month; KPopupFrame* popup = new KPopupFrame(this); int size = 12; if ( QApplication::desktop()->width() >= 480 ) size = 18; KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); // ----- picker->resize(picker->sizeHint()); popup->setMainWidget(picker); picker->setFocus(); connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) { month = picker->getResult(); emit monthSelected ( month ); } else { KNotifyClient::beep(); } delete popup; } void NavigatorBar::selectDates( const KCal::DateList &dateList ) { if (dateList.count() > 0) { QDate date = dateList.first(); const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); // compute the label at the top of the navigator QString dtstr = i18n(calSys->monthName( date )) + " '" + QString::number( calSys->year( date ) ).right(2); mSelectMonth->setText( dtstr ); } } -#include "navigatorbar.moc" diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp index 4eb64f3..0fc90c4 100644 --- a/korganizer/outgoingdialog.cpp +++ b/korganizer/outgoingdialog.cpp @@ -266,129 +266,128 @@ void OutgoingDialog::showEvent(QListViewItem *qitem) case Scheduler::Cancel: { sendText += i18n("All attendees"); break; } case Scheduler::Add: { sendText += i18n("All attendees"); break; } case Scheduler::Reply: { sendText += i18n("The organizer %1").arg(item->event()->organizer()); break; } case Scheduler::Counter: { sendText += i18n("The organizer %1").arg(item->event()->organizer()); break; } case Scheduler::Declinecounter: { sendText += i18n("All attendees"); break; } case Scheduler::NoMethod: { sendText += ""; break; } default: sendText = ""; } eventViewer->addText(sendText); eventViewer->show(); } } bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method, const QString &recipients) { KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics"); QString messageText = mFormat->createScheduleMessage(incidence,method); QTextStream *qts = ktfile.textStream(); *qts << messageText; *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl; *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl; mMessageMap[incidence]=ktfile.name(); return true; } bool OutgoingDialog::deleteMessage(IncidenceBase *incidence) { QFile f( mMessageMap[incidence] ); mMessageMap.remove(incidence); if ( !f.exists() ) return false; else return f.remove(); } void OutgoingDialog::loadMessages() { Scheduler::Method method; QString recipients; QString outgoingDirName = locateLocal("data","korganizer/outgoing"); QDir outgoingDir(outgoingDirName); QStringList outgoing = outgoingDir.entryList(QDir::Files); QStringList::ConstIterator it; for(it = outgoing.begin(); it != outgoing.end(); ++it) { kdDebug() << "-- File: " << (*it) << endl; QFile f(outgoingDirName + "/" + (*it)); bool inserted = false; QMap<IncidenceBase*, QString>::Iterator iter; for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; } if (!inserted) { if (!f.open(IO_ReadOnly)) { kdDebug() << "OutgoingDialog::loadMessage(): Can't open file'" << (*it) << "'" << endl; } else { QTextStream t(&f); QString messageString = t.read(); ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar, messageString); int begin_pos = messageString.find("METHOD-BEGIN:"); begin_pos = messageString.find('\n',begin_pos)+1; QString meth = messageString.mid(begin_pos,1); switch (meth.toInt()) { case 0:method=Scheduler::Publish; break; case 1:method=Scheduler::Request; break; case 2:method=Scheduler::Refresh; break; case 3:method=Scheduler::Cancel; break; case 4:method=Scheduler::Add; break; case 5:method=Scheduler::Reply; break; case 6:method=Scheduler::Counter; break; case 7:method=Scheduler::Declinecounter; break; default :method=Scheduler::NoMethod; break; } begin_pos = messageString.find("RECIPIENTS-BEGIN:"); begin_pos = messageString.find('\n',begin_pos)+1; int end_pos = messageString.find(":RECIPIENTS-END",begin_pos)-1; recipients = messageString.mid(begin_pos, end_pos-begin_pos); kdDebug() << "Outgoing::loadMessage(): Recipients: " << recipients << endl; if (message) { bool inserted = false; QMap<IncidenceBase*, QString>::Iterator iter; for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; } if (!inserted) { kdDebug() << "OutgoingDialog::loadMessage(): got message '" << (*it) << "'" << endl; IncidenceBase *inc = message->event(); new ScheduleItemOut(mMessageListView,inc,method,recipients); mMessageMap[message->event()]=outgoingDirName + "/" + (*it); } } else { QString errorMessage; if (mFormat->exception()) { errorMessage = mFormat->exception()->message(); } kdDebug() << "OutgoingDialog::loadMessage(): Error parsing " "message: " << errorMessage << endl; } f.close(); } } } emit numMessagesChanged(mMessageListView->childCount()); } void OutgoingDialog::setDocumentId( const QString &id ) { mDocPrefs->setDoc( id ); } -#include "outgoingdialog.moc" diff --git a/korganizer/outgoingdialog_base.cpp b/korganizer/outgoingdialog_base.cpp index e5b913a..1873b44 100644 --- a/korganizer/outgoingdialog_base.cpp +++ b/korganizer/outgoingdialog_base.cpp @@ -1,109 +1,107 @@ #include <klocale.h> /**************************************************************************** ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui' ** ** Created: Sat Mar 29 22:31:21 2003 ** by: The User Interface Compiler () ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "outgoingdialog_base.h" #include <qvariant.h> #include <qheader.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> /* * Constructs a OutgoingDialog_base as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "OutgoingDialog_base" ); OutgoingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout"); mMessageListView = new QListView( this, "mMessageListView" ); mMessageListView->addColumn( tr2i18n( "Summary" ) ); mMessageListView->addColumn( tr2i18n( "Start Date" ) ); mMessageListView->addColumn( tr2i18n( "Start Time" ) ); mMessageListView->addColumn( tr2i18n( "End Date" ) ); mMessageListView->addColumn( tr2i18n( "End Time" ) ); mMessageListView->addColumn( tr2i18n( "Method" ) ); mMessageListView->setFrameShape( QListView::StyledPanel ); mMessageListView->setFrameShadow( QListView::Sunken ); mMessageListView->setAllColumnsShowFocus( TRUE ); OutgoingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 3, 0, 0 ); PushButton5 = new QPushButton( this, "PushButton5" ); PushButton5->setDefault( FALSE ); OutgoingDialog_baseLayout->addWidget( PushButton5, 0, 1 ); PushButton7 = new QPushButton( this, "PushButton7" ); OutgoingDialog_baseLayout->addWidget( PushButton7, 1, 1 ); PushButton6 = new QPushButton( this, "PushButton6" ); PushButton6->setDefault( TRUE ); OutgoingDialog_baseLayout->addWidget( PushButton6, 3, 1 ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); OutgoingDialog_baseLayout->addItem( spacer, 2, 1 ); languageChange(); resize( QSize(582, 274).expandedTo(minimumSizeHint()) ); // signals and slots connections connect( PushButton6, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( PushButton5, SIGNAL( clicked() ), this, SLOT( send() ) ); connect( PushButton7, SIGNAL( clicked() ), this, SLOT( deleteItem() ) ); } /* * Destroys the object and frees any allocated resources */ OutgoingDialog_base::~OutgoingDialog_base() { // no need to delete child widgets, Qt does it all for us } /* * Sets the strings of the subwidgets using the current * language. */ void OutgoingDialog_base::languageChange() { setCaption( tr2i18n( "Scheduler - Outgoing Messages" ) ); mMessageListView->header()->setLabel( 0, tr2i18n( "Summary" ) ); mMessageListView->header()->setLabel( 1, tr2i18n( "Start Date" ) ); mMessageListView->header()->setLabel( 2, tr2i18n( "Start Time" ) ); mMessageListView->header()->setLabel( 3, tr2i18n( "End Date" ) ); mMessageListView->header()->setLabel( 4, tr2i18n( "End Time" ) ); mMessageListView->header()->setLabel( 5, tr2i18n( "Method" ) ); PushButton5->setText( tr2i18n( "&Send Messages" ) ); PushButton7->setText( tr2i18n( "&Remove" ) ); PushButton6->setText( tr2i18n( "&Close" ) ); } void OutgoingDialog_base::send() { qWarning( "OutgoingDialog_base::send(): Not implemented yet" ); } void OutgoingDialog_base::deleteItem() { qWarning( "OutgoingDialog_base::deleteItem(): Not implemented yet" ); } - -#include "outgoingdialog_base.moc" diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp index 176595a..4323b91 100644 --- a/korganizer/publishdialog.cpp +++ b/korganizer/publishdialog.cpp @@ -23,130 +23,128 @@ #include <qlineedit.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #ifndef KORG_NOKABC #include <kabc/addresseedialog.h> #endif #include "koprefs.h" #include "publishdialog.h" PublishDialog::PublishDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : PublishDialog_base(parent,name,modal,fl) { setCaption(i18n("Select Addresses")); mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateInput())); } PublishDialog::~PublishDialog() { } void PublishDialog::addAttendee(Attendee *attendee) { mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); item->setText(0,attendee->name()); item->setText(1,attendee->email()); mAddressListView->insertItem(item); } QString PublishDialog::addresses() { QString to = ""; QListViewItem *item; int i, count; count = mAddressListView->childCount(); for (i=0;i<count;i++) { item = mAddressListView->firstChild(); mAddressListView->takeItem(item); to += item->text(1); if (i<count-1) { to += ", "; } } return to; } void PublishDialog::addItem() { mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); mAddressListView->insertItem(item); mAddressListView->setSelected(item,true); mNameLineEdit->setText(i18n("(EmptyName)")); mEmailLineEdit->setText(i18n("(EmptyEmail)")); } void PublishDialog::removeItem() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; mAddressListView->takeItem(item); item = mAddressListView->selectedItem(); if (!item) { mNameLineEdit->setText(""); mEmailLineEdit->setText(""); mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); } if (mAddressListView->childCount() == 0) { mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); } } void PublishDialog::openAddressbook() { #ifndef KORG_NOKABC KABC::Addressee::List addressList; addressList = KABC::AddresseeDialog::getAddressees(this); //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); KABC::Addressee a = addressList.first(); if (!a.isEmpty()) { uint i; for (i=0;i<addressList.count();i++) { a = addressList[i]; mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); mAddressListView->setSelected(item,true); mNameLineEdit->setText(a.realName()); mEmailLineEdit->setText(a.preferredEmail()); mAddressListView->insertItem(item); } } #endif } void PublishDialog::updateItem() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; item->setText(0,mNameLineEdit->text()); item->setText(1,mEmailLineEdit->text()); } void PublishDialog::updateInput() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QString mail = item->text(1); mNameLineEdit->setText(item->text(0)); mEmailLineEdit->setText(mail); } - -#include "publishdialog.moc" diff --git a/korganizer/publishdialog_base.cpp b/korganizer/publishdialog_base.cpp index 75e4746..683f7e9 100644 --- a/korganizer/publishdialog_base.cpp +++ b/korganizer/publishdialog_base.cpp @@ -33,130 +33,128 @@ PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool { if ( !name ) setName( "PublishDialog_base" ); PublishDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout"); mAddressListView = new QListView( this, "mAddressListView" ); mAddressListView->addColumn( tr2i18n( "Name" ) ); mAddressListView->addColumn( tr2i18n( "Email" ) ); PublishDialog_baseLayout->addMultiCellWidget( mAddressListView, 0, 3, 0, 1 ); TextLabel1 = new QLabel( this, "TextLabel1" ); PublishDialog_baseLayout->addWidget( TextLabel1, 4, 0 ); TextLabel2 = new QLabel( this, "TextLabel2" ); PublishDialog_baseLayout->addWidget( TextLabel2, 5, 0 ); mEmailLineEdit = new QLineEdit( this, "mEmailLineEdit" ); PublishDialog_baseLayout->addWidget( mEmailLineEdit, 5, 1 ); mNameLineEdit = new QLineEdit( this, "mNameLineEdit" ); PublishDialog_baseLayout->addWidget( mNameLineEdit, 4, 1 ); PushButton10 = new QPushButton( this, "PushButton10" ); PublishDialog_baseLayout->addWidget( PushButton10, 0, 2 ); PushButton12 = new QPushButton( this, "PushButton12" ); PublishDialog_baseLayout->addWidget( PushButton12, 2, 2 ); PushButton11 = new QPushButton( this, "PushButton11" ); PublishDialog_baseLayout->addWidget( PushButton11, 1, 2 ); QSpacerItem* spacer = new QSpacerItem( 20, 241, QSizePolicy::Minimum, QSizePolicy::Expanding ); PublishDialog_baseLayout->addMultiCell( spacer, 3, 5, 2, 2 ); Line2 = new QFrame( this, "Line2" ); Line2->setFrameShape( QFrame::HLine ); Line2->setFrameShadow( QFrame::Sunken ); Line2->setFrameShape( QFrame::HLine ); PublishDialog_baseLayout->addMultiCellWidget( Line2, 6, 6, 0, 2 ); layout95 = new QHBoxLayout( 0, 0, 6, "layout95"); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout95->addItem( spacer_2 ); PushButton9 = new QPushButton( this, "PushButton9" ); PushButton9->setDefault( TRUE ); layout95->addWidget( PushButton9 ); PushButton8 = new QPushButton( this, "PushButton8" ); layout95->addWidget( PushButton8 ); PublishDialog_baseLayout->addMultiCellLayout( layout95, 7, 7, 0, 2 ); languageChange(); resize( QSize(420, 379).expandedTo(minimumSizeHint()) ); // signals and slots connections connect( PushButton10, SIGNAL( clicked() ), this, SLOT( addItem() ) ); connect( PushButton11, SIGNAL( clicked() ), this, SLOT( removeItem() ) ); connect( PushButton12, SIGNAL( clicked() ), this, SLOT( openAddressbook() ) ); connect( PushButton9, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( mNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) ); connect( mEmailLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) ); connect( PushButton8, SIGNAL( clicked() ), this, SLOT( reject() ) ); // tab order setTabOrder( mAddressListView, mNameLineEdit ); setTabOrder( mNameLineEdit, mEmailLineEdit ); setTabOrder( mEmailLineEdit, PushButton10 ); setTabOrder( PushButton10, PushButton11 ); setTabOrder( PushButton11, PushButton12 ); setTabOrder( PushButton12, PushButton9 ); setTabOrder( PushButton9, PushButton8 ); } /* * Destroys the object and frees any allocated resources */ PublishDialog_base::~PublishDialog_base() { // no need to delete child widgets, Qt does it all for us } /* * Sets the strings of the subwidgets using the current * language. */ void PublishDialog_base::languageChange() { setCaption( tr2i18n( "Form1" ) ); mAddressListView->header()->setLabel( 0, tr2i18n( "Name" ) ); mAddressListView->header()->setLabel( 1, tr2i18n( "Email" ) ); TextLabel1->setText( tr2i18n( "Name:" ) ); TextLabel2->setText( tr2i18n( "Email:" ) ); PushButton10->setText( tr2i18n( "&New" ) ); PushButton12->setText( tr2i18n( "&Addressbook" ) ); PushButton11->setText( tr2i18n( "&Remove" ) ); PushButton9->setText( tr2i18n( "&OK" ) ); PushButton8->setText( tr2i18n( "&Cancel" ) ); } void PublishDialog_base::addItem() { qWarning( "PublishDialog_base::addItem(): Not implemented yet" ); } void PublishDialog_base::removeItem() { qWarning( "PublishDialog_base::removeItem(): Not implemented yet" ); } void PublishDialog_base::openAddressbook() { qWarning( "PublishDialog_base::openAddressbook(): Not implemented yet" ); } void PublishDialog_base::updateItem() { qWarning( "PublishDialog_base::updateItem(): Not implemented yet" ); } - -#include "publishdialog_base.moc" diff --git a/korganizer/savetemplatedialog.cpp b/korganizer/savetemplatedialog.cpp index 0da524f..3544081 100644 --- a/korganizer/savetemplatedialog.cpp +++ b/korganizer/savetemplatedialog.cpp @@ -1,76 +1,75 @@ /* This file is part of KOrganizer. Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <keditlistbox.h> #include <klocale.h> #include "koprefs.h" #include "savetemplatedialog.h" -#include "savetemplatedialog.moc" SaveTemplateDialog::SaveTemplateDialog( IncidenceType type, QWidget *parent ) : KDialogBase( Plain, i18n("Save Template"), Ok | Cancel, Ok, parent, 0, true, false ), mType( type ) { QFrame *topFrame = plainPage(); QVBoxLayout *topLayout = new QVBoxLayout( topFrame, 0, spacingHint() ); mEditListBox = new KEditListBox( i18n("Select Template Name"), topFrame, 0, false, KEditListBox::Add | KEditListBox::Remove ); topLayout->addWidget( mEditListBox ); connect( mEditListBox, SIGNAL( changed() ), SLOT( slotChanged() ) ); QStringList templates; if ( mType == EventType ) { templates = KOPrefs::instance()->mEventTemplates; } else if( mType == TodoType ) { templates = KOPrefs::instance()->mTodoTemplates; } mEditListBox->insertStringList( templates ); } SaveTemplateDialog::~SaveTemplateDialog() { } void SaveTemplateDialog::slotOk() { emit templateSelected( mEditListBox->currentText() ); accept(); } void SaveTemplateDialog::slotChanged() { if ( mType == EventType ) { KOPrefs::instance()->mEventTemplates = mEditListBox->items(); } else if( mType == TodoType ) { KOPrefs::instance()->mTodoTemplates = mEditListBox->items(); } } diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 74d48b9..5bd7c6f 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -1,171 +1,170 @@ /* This file is part of KOrganizer. Copyright (c) 1998 Preston Brown Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qcheckbox.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> #include <klocale.h> #include <kmessagebox.h> #include <libkdepim/kdateedit.h> #include "koglobals.h" #include "koprefs.h" #include "calendarview.h" #include "koviewmanager.h" #include "searchdialog.h" -#include "searchdialog.moc" SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false, i18n("&Find")) { mCalendar = calendar; QFrame *topFrame = plainPage(); QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint()); // Search expression QHBoxLayout *subLayout = new QHBoxLayout(); layout->addLayout(subLayout); searchLabel = new QLabel(topFrame); searchLabel->setText(i18n("Search for:")); subLayout->addWidget(searchLabel); searchEdit = new QLineEdit(topFrame); subLayout->addWidget(searchEdit); searchEdit->setText("*"); // Find all events by default searchEdit->setFocus(); connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); // Subjects to search // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), // topFrame); QHBox *incidenceGroup = new QHBox( topFrame ); layout->addWidget(incidenceGroup); mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); mSearchEvent->setChecked(true); mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); QHBox *subjectGroup = new QHBox( topFrame ); layout->addWidget(subjectGroup); mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup); mSummaryCheck->setChecked(true); mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); QHBox *attendeeGroup = new QHBox( topFrame ); layout->addWidget(attendeeGroup ); new QLabel( i18n("Attendee:"),attendeeGroup ); mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); // Date range // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), // topFrame); // layout->addWidget(rangeGroup); QWidget *rangeWidget = new QWidget(topFrame); QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); mStartDate = new KDateEdit(rangeWidget); rangeLayout->addWidget(mStartDate); rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); mEndDate = new KDateEdit(rangeWidget); mEndDate->setDate(QDate::currentDate().addDays(365)); rangeLayout->addWidget(mEndDate); // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame); //mInclusiveCheck->setChecked(false); layout->addWidget(rangeWidget); //layout->addWidget(mInclusiveCheck); // Subjects to search // Results list view listView = new KOListView(mCalendar,topFrame); //listView->showDates(); layout->addWidget(listView); // if ( KOPrefs::instance()->mCompactDialogs ) { // KOGlobals::fitDialogToScreen( this, true ); // } listView->readSettings(KOGlobals::config(),"SearchListView Layout"); connect(this,SIGNAL(user1Clicked()),SLOT(doSearch())); QPushButton *CloseButton = findButton( Close ); //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear())); #ifndef DESKTOP_VERSION setCaption(i18n("Click OK to search ->")); hideButtons(); #endif } SearchDialog::~SearchDialog() { } void SearchDialog::accept() { doSearch(); } void SearchDialog::updateList() { //listView->updateList(); if ( isVisible() ) { updateView(); //qDebug("SearchDialog::updated "); } else { listView->clear(); //qDebug("SearchDialog::cleared "); } } void SearchDialog::searchTextChanged( const QString &_text ) { enableButton( KDialogBase::User1, !_text.isEmpty() ); } void SearchDialog::doSearch() { QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern(searchEdit->text()); diff --git a/korganizer/statusdialog.cpp b/korganizer/statusdialog.cpp index 78efeb0..7137c49 100644 --- a/korganizer/statusdialog.cpp +++ b/korganizer/statusdialog.cpp @@ -1,67 +1,66 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlabel.h> #include <qpushbutton.h> #include <qstringlist.h> #include <qlayout.h> #include <kdebug.h> #include <klocale.h> #include "statusdialog.h" -#include "statusdialog.moc" StatusDialog::StatusDialog(QWidget* parent, const char* name) : KDialog(parent,name,true) { setCaption(i18n("Set Your Status")); QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( spacingHint() ); topLayout->setMargin( marginHint() ); QBoxLayout *statusLayout = new QHBoxLayout( topLayout ); QLabel *text = new QLabel(i18n("Set your status"),this); statusLayout->addWidget( text ); mStatus = new QComboBox(false,this); mStatus->insertStringList(Attendee::statusList()); statusLayout->addWidget( mStatus ); QBoxLayout *buttonLayout = new QHBoxLayout( topLayout ); QPushButton *ok = new QPushButton(i18n("&OK"), this); connect ( ok,SIGNAL(clicked()), this,SLOT(accept()) ); buttonLayout->addWidget( ok ); QPushButton *cancel = new QPushButton(i18n("&Cancel"), this); connect ( cancel,SIGNAL(clicked()), this,SLOT(reject()) ); buttonLayout->addWidget( cancel ); } StatusDialog::~StatusDialog() { } Attendee::PartStat StatusDialog::status() { return Attendee::PartStat( mStatus->currentItem() ) ; } diff --git a/korganizer/timeline.cpp b/korganizer/timeline.cpp index 6f9c8dd..11be432 100644 --- a/korganizer/timeline.cpp +++ b/korganizer/timeline.cpp @@ -1,63 +1,62 @@ #include <qpainter.h> #include <kdebug.h> #include "timeline.h" -#include "timeline.moc" TimeLine::TimeLine( QWidget *parent, const char *name ) : QScrollView( parent, name ) { mPixelWidth = 1000; resizeContents( mPixelWidth, 20 ); viewport()->setBackgroundMode( PaletteBackground ); setHScrollBarMode(AlwaysOff); setVScrollBarMode(AlwaysOff); } TimeLine::~TimeLine() { } void TimeLine::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { int spacingX = mDaySpacing; int offsetX = mDayOffset; // Draw vertical lines of grid // kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; int cell = int( (cx - ( spacingX - offsetX ) ) / spacingX ); int x = cell * spacingX + ( spacingX - offsetX ); // kdDebug() << " x: " << x << endl; while (x < cx + cw) { // kdDebug() << " x: " << x << endl; p->drawLine(x,cy,x,cy+ch); p->drawText( x + 5, 15, QString::number( mStartDate.addDays( cell + 1 ).date().day() ) ); x += spacingX; cell++; } } void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end ) { mStartDate = start; mEndDate = end; mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth; mDaySpacing = 60 * 60 * 24 / mSecsPerPixel; mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel; kdDebug() << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: " << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl; } void TimeLine::setContentsPos( int pos ) { QScrollView::setContentsPos ( pos, 0 ); } diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp index f8314e7..67a3811 100644 --- a/korganizer/timespanview.cpp +++ b/korganizer/timespanview.cpp @@ -1,147 +1,146 @@ #ifndef DESKTOP_VERSION #include <qksplitter.h> #else #include <qsplitter.h> #endif #include <qlistview.h> #include <qlayout.h> #include <qheader.h> #include <qpushbutton.h> #include <klocale.h> #include <kdebug.h> #include "lineview.h" #include "timeline.h" #include "timespanview.h" -#include "timespanview.moc" TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : QWidget( parent, name ) { QBoxLayout *topLayout = new QVBoxLayout( this ); #ifndef DESKTOP_VERSION mSplitter = new QKSplitter( this ); #else mSplitter = new QSplitter( this ); #endif topLayout->addWidget( mSplitter ); mList = new QListView( mSplitter ); mList->addColumn( i18n("Summary") ); QWidget *rightPane = new QWidget( mSplitter ); QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); mTimeLine = new TimeLine( rightPane ); mTimeLine->setFixedHeight( mList->header()->height() ); rightPaneLayout->addWidget( mTimeLine ); mLineView = new LineView( rightPane ); rightPaneLayout->addWidget( mLineView ); QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); buttonLayout->addWidget( zoomInButton ); QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); buttonLayout->addWidget( zoomOutButton ); QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); buttonLayout->addWidget( centerButton ); connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), mTimeLine,SLOT(setContentsPos(int))); } TimeSpanView::~TimeSpanView() { } QValueList<int> TimeSpanView::splitterSizes() { return mSplitter->sizes(); } void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) { mSplitter->setSizes( sizes ); } void TimeSpanView::addItem( KCal::Event *event ) { new QListViewItem( mList, event->summary() ); QDateTime startDt = event->dtStart(); QDateTime endDt = event->dtEnd(); // kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() // << " end: " << endDt.toString() << endl; int startSecs = mStartDate.secsTo( startDt ); int durationSecs = startDt.secsTo( endDt ); // kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; // kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; mLineView->addLine( startX, endX ); } void TimeSpanView::clear() { mList->clear(); mLineView->clear(); } void TimeSpanView::updateView() { #if QT_VERSION >= 300 mLineView->updateContents(); mTimeLine->updateContents(); #else #endif } void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end ) { mStartDate = start; mEndDate = end; mTimeLine->setDateRange( start, end ); mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); } QDateTime TimeSpanView::startDateTime() { return mStartDate; } QDateTime TimeSpanView::endDateTime() { return mEndDate; } void TimeSpanView::zoomIn() { int span = mStartDate.daysTo( mEndDate ); setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); emit dateRangeChanged(); } void TimeSpanView::zoomOut() { int span = mStartDate.daysTo( mEndDate ); setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index dc198bd..32aac7a 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -298,129 +298,129 @@ QPtrList<Event> Calendar::events() bool Calendar::addIncidence(Incidence *i) { Incidence::AddVisitor<Calendar> v(this); return i->accept(v); } void Calendar::deleteIncidence(Incidence *in) { if ( in->type() == "Event" ) deleteEvent( (Event*) in ); else if ( in->type() =="Todo" ) deleteTodo( (Todo*) in); else if ( in->type() =="Journal" ) deleteJournal( (Journal*) in ); } Incidence* Calendar::incidence( const QString& uid ) { Incidence* i; if( (i = todo( uid )) != 0 ) return i; if( (i = event( uid )) != 0 ) return i; if( (i = journal( uid )) != 0 ) return i; return 0; } QPtrList<Todo> Calendar::todos() { QPtrList<Todo> tl = rawTodos(); mFilter->apply( &tl ); return tl; } // When this is called, the todo have already been added to the calendar. // This method is only about linking related todos void Calendar::setupRelations( Incidence *incidence ) { QString uid = incidence->uid(); //qDebug("Calendar::setupRelations "); // First, go over the list of orphans and see if this is their parent while( Incidence* i = mOrphans[ uid ] ) { mOrphans.remove( uid ); i->setRelatedTo( incidence ); incidence->addRelation( i ); mOrphanUids.remove( i->uid() ); } // Now see about this incidences parent if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { // This incidence has a uid it is related to, but is not registered to it yet // Try to find it Incidence* parent = this->incidence( incidence->relatedToUid() ); if( parent ) { // Found it incidence->setRelatedTo( parent ); parent->addRelation( incidence ); } else { // Not found, put this in the mOrphans list mOrphans.insert( incidence->relatedToUid(), incidence ); mOrphanUids.insert( incidence->uid(), incidence ); } } } // If a task with subtasks is deleted, move it's subtasks to the orphans list void Calendar::removeRelations( Incidence *incidence ) { // qDebug("Calendar::removeRelations "); QString uid = incidence->uid(); QPtrList<Incidence> relations = incidence->relations(); for( Incidence* i = relations.first(); i; i = relations.next() ) if( !mOrphanUids.find( i->uid() ) ) { mOrphans.insert( uid, i ); mOrphanUids.insert( i->uid(), i ); i->setRelatedTo( 0 ); i->setRelatedToUid( uid ); } // If this incidence is related to something else, tell that about it if( incidence->relatedTo() ) incidence->relatedTo()->removeRelation( incidence ); // Remove this one from the orphans list if( mOrphanUids.remove( uid ) ) // This incidence is located in the orphans list - it should be removed if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { // Removing wasn't that easy for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { if( it.current()->uid() == uid ) { mOrphans.remove( it.currentKey() ); break; } } } } void Calendar::registerObserver( Observer *observer ) { mObserver = observer; mNewObserver = true; } void Calendar::setModified( bool modified ) { if ( mObserver ) mObserver->calendarModified( modified, this ); if ( modified != mModified || mNewObserver ) { mNewObserver = false; // if ( mObserver ) mObserver->calendarModified( modified, this ); mModified = modified; } } void Calendar::setLoadedProductId( const QString &id ) { mLoadedProductId = id; } QString Calendar::loadedProductId() { return mLoadedProductId; } -#include "calendar.moc" +//#include "calendar.moc" |