author | zautrix <zautrix> | 2005-01-26 23:05:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-26 23:05:26 (UTC) |
commit | 15351333eff09beadb6e691e9f0aab2aaf0a95a0 (patch) (side-by-side diff) | |
tree | 443fba1e36ef3a2549b531fe600567d9e1232d7c | |
parent | 96fc3903cf690957d0242d7aa2894bd64800edcc (diff) | |
download | kdepimpi-15351333eff09beadb6e691e9f0aab2aaf0a95a0.zip kdepimpi-15351333eff09beadb6e691e9f0aab2aaf0a95a0.tar.gz kdepimpi-15351333eff09beadb6e691e9f0aab2aaf0a95a0.tar.bz2 |
fixes
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 37 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 7 | ||||
-rw-r--r-- | korganizer/kodialogmanager.cpp | 7 |
4 files changed, 51 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 06454c2..1d5a57e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2484,82 +2484,82 @@ void CalendarView::moveIncidence(Incidence * inc ) } //PENDING set date for recurring incidence to date of recurrence //mMoveIncidenceOldDate; mDatePicker->setDate( da ); } void CalendarView::showDatePicker( ) { //qDebug("CalendarView::showDatePicker( ) "); if ( mDateFrame->isVisible() ) mDateFrame->hide(); else { int w =mDatePicker->sizeHint().width() ; int h = mDatePicker->sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); mDateFrame->show(); } mDatePickerMode = 1; mDatePicker->setDate( mNavigator->selectedDates().first() ); } void CalendarView::showEventEditor() { #ifdef DESKTOP_VERSION mEventEditor->show(); #else if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); delete mEventEditor; mEventEditor = mDialogManager->getEventEditor(); + topLevelWidget()->setCaption( i18n("") ); } mEventEditor->showMaximized(); - topLevelWidget()->setCaption( i18n("") ); #endif } void CalendarView::showTodoEditor() { #ifdef DESKTOP_VERSION mTodoEditor->show(); #else if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); delete mTodoEditor; mTodoEditor = mDialogManager->getTodoEditor(); + topLevelWidget()->setCaption( i18n("") ); } mTodoEditor->showMaximized(); - topLevelWidget()->setCaption( i18n("") ); #endif } void CalendarView::cloneIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { cloneIncidence(incidence); } } void CalendarView::moveIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { moveIncidence(incidence); } } void CalendarView::beamIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { beamIncidence(incidence); } } void CalendarView::toggleCancelIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 6428757..b5596d9 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -173,64 +173,99 @@ int TimeLabels::minimumWidth() const 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); } /** */ void TimeLabels::setAgenda(KOAgenda* agenda) { mAgenda = agenda; } +void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) +{ + mMouseDownY = e->pos().y(); +} + +void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) +{ + int diff = mMouseDownY - e->pos().y(); + if ( diff < 10 && diff > -10 ) + return; + int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; + if ( tSize < 4 ) + tSize = 4; + if ( tSize > 18 ) + tSize = 18; + tSize = (tSize-2)/2; + topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); + +} +void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) +{ + int diff = mMouseDownY - e->pos().y(); + if ( diff < 10 && diff > -10 ) + return; + int tSize = KOPrefs::instance()->mHourSize + (diff/10); + if ( tSize < 4 ) + tSize = 4; + if ( tSize > 18 ) + tSize = 18; + tSize = (tSize/2)*2; + if ( tSize == KOPrefs::instance()->mHourSize ) + return; + KOPrefs::instance()->mHourSize = tSize; + emit scaleChanged(); +} /** This is called in response to repaint() */ void TimeLabels::paintEvent(QPaintEvent*) { // kdDebug() << "paintevent..." << endl; // this is another hack! // QPainter painter(this); //QString c repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); } //////////////////////////////////////////////////////////////////////////// EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) : QFrame(parent,name) { mColumns = 1; mTopBox = 0; mLocation = loc; mTopLayout = 0; mPaintWidget = 0; mXOffset = 0; if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); else mPixmap = SmallIcon("1downarrow"); mEnabled.resize(mColumns); if (mLocation == Top) setMaximumHeight(0); else setMinimumHeight(mPixmap.height()); } @@ -381,64 +416,66 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : widebut = (widebut*3) / 2; //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, // QSizePolicy::Fixed ) ); mExpandButton->setFixedSize( widebut, widebut); connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); mExpandButton->setFocusPolicy(NoFocus); mAllDayAgenda = new KOAgenda(1,mAllDayFrame); mAllDayAgenda->setFocusPolicy(NoFocus); QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); // Create event context menu for all day agenda mAllDayAgendaPopup = eventPopup(); connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); // Create agenda frame QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); // QHBox *agendaFrame = new QHBox(splitterAgenda); // create event indicator bars mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); agendaLayout->addWidget(mEventIndicatorTop,0,1); mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, agendaFrame); agendaLayout->addWidget(mEventIndicatorBottom,2,1); QWidget *dummyAgendaRight = new QWidget(agendaFrame); agendaLayout->addWidget(dummyAgendaRight,0,2); // Create time labels mTimeLabels = new TimeLabels(24,agendaFrame); agendaLayout->addWidget(mTimeLabels,1,0); + connect(mTimeLabels,SIGNAL( scaleChanged()), + this,SLOT(updateConfig())); // Create agenda mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); agendaLayout->setColStretch(1,1); mAgenda->setFocusPolicy(NoFocus); // Create event context menu for agenda mAgendaPopup = eventPopup(); mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), i18n("Toggle Alarm"),mAgenda, SLOT(popupAlarm()),true); connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); // make connections between dependent widgets mTimeLabels->setAgenda(mAgenda); // Update widgets to reflect user preferences // updateConfig(); // createDayLabels(); // these blank widgets make the All Day Event box line up with the agenda dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); // Scrolling connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 0079253..221b0ea 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -34,73 +34,78 @@ #include <qmemarray.h> #include "koeventview.h" class QHBox; class QFrame; class QLabel; class QPushButton; class CalendarView; class KOAgenda; class KOAgendaItem; class KConfig; class KDGanttMinimizeSplitter; class TimeLabels : public QScrollView { Q_OBJECT public: TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); void setCellHeight(int height); /** Calculates the minimum width */ virtual int minimumWidth() const; /** updates widget's internal state */ void updateConfig(); /** */ void setAgenda(KOAgenda* agenda); /** */ virtual void paintEvent(QPaintEvent* e); + void contentsMousePressEvent ( QMouseEvent * ) ; + void contentsMouseReleaseEvent ( QMouseEvent * ); + void contentsMouseMoveEvent ( QMouseEvent * ); public slots: /** update time label positions */ void positionChanged(); - + signals: + void scaleChanged(); protected: void drawContents(QPainter *p,int cx, int cy, int cw, int ch); private: + int mMouseDownY; int mRows; int mCellHeight; /** */ KOAgenda* mAgenda; }; class EventIndicator : public QFrame { Q_OBJECT public: enum Location { Top, Bottom }; EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); virtual ~EventIndicator(); void changeColumns(int columns); void setPaintWidget( KDGanttMinimizeSplitter* ); void setXOffset( int ); void enableColumn(int column, bool enable); protected: void drawContents(QPainter *); private: int mXOffset; KDGanttMinimizeSplitter* mPaintWidget; int mColumns; QHBox *mTopBox; QBoxLayout *mTopLayout; Location mLocation; QPixmap mPixmap; QMemArray<bool> mEnabled; }; diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index c99c0cb..41a4dc1 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp @@ -264,78 +264,83 @@ void KODialogManager::showPluginDialog() mPluginDialog->show(); mPluginDialog->raise(); #endif } KOEventEditor *KODialogManager::getEventEditor() { KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), mMainView ); connect(eventEditor,SIGNAL(eventAdded(Event *)), mMainView,SLOT(eventAdded(Event *))); connect(eventEditor,SIGNAL(eventChanged(Event *)), mMainView,SLOT(eventChanged(Event *))); connect(eventEditor,SIGNAL(eventDeleted()), mMainView,SLOT(eventDeleted())); connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), mMainView,SLOT(schedule_cancel(Incidence *))); connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); connect( eventEditor, SIGNAL( showAgendaView( bool)), mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), // eventEditor,SLOT(updateCategoryConfig())); // connect(eventEditor,SIGNAL(editCategories()), // mCategoryEditDialog,SLOT(show())); connect(eventEditor,SIGNAL(dialogClose(Incidence*)), mMainView,SLOT(dialogClosing(Incidence*))); //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); +#ifndef DESKTOP_VERSION + eventEditor->resize( QApplication::desktop()->width() -20, 100 ); +#endif return eventEditor; } KOTodoEditor *KODialogManager::getTodoEditor() { KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), mMainView ); // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), // todoEditor,SLOT(updateCategoryConfig())); // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); connect(todoEditor,SIGNAL(todoAdded(Todo *)), mMainView,SLOT(todoAdded(Todo *))); connect(todoEditor,SIGNAL(todoChanged(Todo *)), mMainView,SLOT(todoChanged(Todo *))); connect(todoEditor,SIGNAL(todoDeleted()), mMainView,SLOT(todoDeleted())); connect(todoEditor,SIGNAL(dialogClose(Incidence*)), mMainView,SLOT(dialogClosing(Incidence*))); connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); connect( todoEditor, SIGNAL( showAgendaView( bool)), mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), // mMainView,SLOT(schedule_cancel(Incidence *))); //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); - +#ifndef DESKTOP_VERSION + todoEditor->resize( QApplication::desktop()->width() -20, 100 ); +#endif return todoEditor; } void KODialogManager::updateSearchDialog() { if (mSearchDialog) mSearchDialog->updateView(); } void KODialogManager::setDocumentId( const QString &id ) { if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); } void KODialogManager::writeSettings( KConfig *config ) { if (mSearchDialog) mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); } |