summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-31 11:47:44 (UTC)
committer zautrix <zautrix>2005-01-31 11:47:44 (UTC)
commit0ee7cc932ca9c973b086f847a38d29531a815712 (patch) (side-by-side diff)
treec16662cdcfffb31d517ff700aa6dcd13f2f8c643
parent3e0b1c7cd48903b6886e081210cd83b7441b48ac (diff)
downloadkdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.zip
kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.gz
kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.bz2
many fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/komonthview.cpp1
-rw-r--r--korganizer/kotodoview.cpp17
-rw-r--r--korganizer/kotodoview.h2
-rw-r--r--korganizer/koviewmanager.cpp13
-rw-r--r--korganizer/koviewmanager.h2
6 files changed, 28 insertions, 8 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index db33017..cca73f2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2139,49 +2139,48 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
// most of the changeEventDisplays() right now just call the view's
// total update mode, but they SHOULD be recoded to be more refresh-efficient.
void CalendarView::changeEventDisplay(Event *which, int action)
{
// kdDebug() << "CalendarView::changeEventDisplay" << endl;
changeIncidenceDisplay((Incidence *)which, action);
mDateNavigator->updateView();
//mDialogManager->updateSearchDialog();
if (which) {
// If there is an event view visible update the display
mViewManager->currentView()->changeEventDisplay(which,action);
// TODO: check, if update needed
// if (which->getTodoStatus()) {
mTodoList->updateView();
// }
} else {
mViewManager->currentView()->updateView();
}
}
void CalendarView::updateTodoViews()
{
-
mTodoList->updateView();
mViewManager->currentView()->updateView();
}
void CalendarView::updateView(const QDate &start, const QDate &end)
{
mTodoList->updateView();
mViewManager->updateView(start, end);
//mDateNavigator->updateView();
}
void CalendarView::updateView()
{
DateList tmpList = mNavigator->selectedDates();
if ( KOPrefs::instance()->mHideNonStartedTodos )
mTodoList->updateView();
// We assume that the navigator only selects consecutive days.
updateView( tmpList.first(), tmpList.last() );
}
void CalendarView::updateUnmanagedViews()
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4cefb26..770a42b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -952,48 +952,49 @@ void KOMonthView::changeEventDisplay(Event *, int)
// quick-and-dirty-hack gets the job done for right now.
updateView();
}
void KOMonthView::updateView()
{
if ( !updatePossible )
return;
//qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
int i;
for( i = 0; i < mCells.count(); ++i ) {
mCells[i]->updateCell();
}
//qDebug("KOMonthView::updateView() ");
processSelectionChange();
// qDebug("---------------------------------------------------------------------+ ");
mCells[0]->setFocus();
}
void KOMonthView::resizeEvent(QResizeEvent * e)
{
computeLayout();
+ mCells[0]->setFocus();
}
void KOMonthView::computeLayout()
{
// select the appropriate heading string size. E.g. "Wednesday" or "Wed".
// note this only changes the text if the requested size crosses the
// threshold between big enough to support the full name and not big
// enough.
int daysToShow = 7;
bool combinedSatSun = false;
if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
daysToShow = 6;
combinedSatSun = true;
}
int tWid = topLevelWidget()->size().width();
int tHei = topLevelWidget()->size().height();
int wid = size().width();//e
int hei = size().height()-1;
if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
return;
//qDebug("KOMonthView::computeLayout()------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8d8fc2a..82437d8 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -313,48 +313,49 @@ void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
KOQuickTodo::KOQuickTodo(QWidget *parent) :
QLineEdit(parent)
{
setText(i18n("Click to add a new Todo"));
}
void KOQuickTodo::focusInEvent(QFocusEvent *ev)
{
if ( text()==i18n("Click to add a new Todo") )
setText("");
QLineEdit::focusInEvent(ev);
}
void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
{
setText(i18n("Click to add a new Todo"));
QLineEdit::focusOutEvent(ev);
}
/////////////////////////////////////////////////////////////////////////////
KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
KOrg::BaseView(calendar,parent,name)
{
+ mPendingUpdateBeforeRepaint = false;
isFlatDisplay = false;
mNavigator = 0;
QBoxLayout *topLayout = new QVBoxLayout(this);
mName = QString ( name );
mBlockUpdate = false;
mQuickAdd = new KOQuickTodo(this);
topLayout->addWidget(mQuickAdd);
if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
mTodoListView = new KOTodoListView(calendar,this, name );
topLayout->addWidget(mTodoListView);
//mTodoListView->header()->setMaximumHeight(30);
mTodoListView->setRootIsDecorated(true);
mTodoListView->setAllColumnsShowFocus(true);
mTodoListView->setShowSortIndicator(true);
mTodoListView->addColumn(i18n("Todo"));
mTodoListView->addColumn(i18n("Prio"));
mTodoListView->setColumnAlignment(1,AlignHCenter);
mTodoListView->addColumn(i18n("Complete"));
mTodoListView->setColumnAlignment(2,AlignCenter);
@@ -512,56 +513,68 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
connect( mTodoListView, SIGNAL(selectionChanged() ),
SLOT( processSelectionChange() ) );
connect( mQuickAdd, SIGNAL( returnPressed () ),
SLOT( addQuickTodo() ) );
}
KOTodoView::~KOTodoView()
{
delete mDocPrefs;
}
void KOTodoView::jumpToDate ()
{
// if (mActiveItem) {
// mActiveItem->todo());
// if ( mActiveItem->todo()->hasDueDate() )
// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
}
-
+void KOTodoView::paintEvent(QPaintEvent * pevent)
+{
+ if ( mPendingUpdateBeforeRepaint ) {
+ updateView();
+ mPendingUpdateBeforeRepaint = false;
+ }
+ KOrg::BaseView::paintEvent( pevent);
+}
+ bool mPendingUpdateBeforeRepaint;
void KOTodoView::updateView()
{
pendingSubtodo = 0;
if ( mBlockUpdate ) {
- //qDebug("blocked ");
return;
}
+ if ( !isVisible() ) {
+ mPendingUpdateBeforeRepaint = true;
+ return;
+ }
+ //qDebug("KOTodoView::updateView() %x", this);
if ( isFlatDisplay ) {
setAllFlat();
return;
}
//qDebug("update ");
// kdDebug() << "KOTodoView::updateView()" << endl;
QFont fo = KOPrefs::instance()->mTodoViewFont;
mTodoListView->clear();
if ( mName == "todolistsmall" ) {
if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
int ps = fo.pointSize() -2;
if ( ps > 12 )
ps -= 2;
fo.setPointSize( ps );
}
}
mTodoListView->setFont( fo );
// QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
//mTodoListView->header()->setMaximumHeight(fm.height());
QPtrList<Todo> todoList = calendar()->todos();
/*
kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 68e29bb..16bc133 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -192,48 +192,50 @@ class KOTodoView : public KOrg::BaseView
void isModified(bool);
void cloneTodoSignal( Incidence * );
void cancelTodoSignal( Incidence * );
void moveTodoSignal( Incidence * );
void beamTodoSignal( Incidence * );
void purgeCompletedSignal();
protected slots:
void processSelectionChange();
void addQuickTodo();
void setTodoModified( Todo* );
void todoModified(Todo *, int );
private:
/*
* the TodoEditor approach is rather unscaling in the long
* run.
* Korganizer keeps it in memory and we need to update
* 1. make KOTodoViewItem a QObject again?
* 2. add a public method for setting one todo modified?
* 3. add a private method for setting a todo modified + friend here?
* -- zecke 2002-07-08
*/
+ void paintEvent(QPaintEvent * pevent);
+ bool mPendingUpdateBeforeRepaint;
friend class KOTodoViewItem;
QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
void restoreItemState( QListViewItem * );
bool checkTodo( Todo * );
bool isFlatDisplay;
void setOpen( QListViewItem*, bool setOpen);
KOTodoListView *mTodoListView;
QPopupMenu *mItemPopupMenu;
QPopupMenu *mPopupMenu;
QPopupMenu *mPriorityPopupMenu;
QPopupMenu *mPercentageCompletedPopupMenu;
QPopupMenu *mCategoryPopupMenu;
QMap<int, int> mPercentage;
QMap<int, int> mPriority;
QMap<int, QString> mCategory;
KOTodoViewItem *mActiveItem;
QMap<Todo *,KOTodoViewItem *> mTodoMap;
QString mName;
DocPrefs *mDocPrefs;
QString mCurrentDoc;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 35774d6..2cd8792 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -183,117 +183,120 @@ 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();
- raiseCurrentView( full );
+ //mMainView->updateView();
+ raiseCurrentView( full, true );
mMainView->adaptNavigationUnits();
}
-void KOViewManager::raiseCurrentView( bool fullScreen )
+void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
{
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();
if ( KOPrefs::instance()->mVerticalScreen )
hei -= mMainView->leftFrame()->height();
else
wid -= mMainView->leftFrame()->width();
}
emit signalFullScreen( !fullScreen );
+ if ( callUpdateView )
+ mMainView->updateView();
+
if ( globalFlagBlockAgenda == 5 ) {
globalFlagBlockAgenda = 4;
globalFlagBlockAgendaItemPaint = 1;
}
mMainView->viewStack()->raiseWidget(mCurrentView);
if ( globalFlagBlockAgenda == 4 ) {
if ( mCurrentView == mAgendaView ) {
//globalFlagBlockAgenda =1 ;
if ( KOPrefs::instance()->mSetTimeToDayStartAt )
mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
else if ( KOPrefs::instance()->mCenterOnCurrentTime )
mAgendaView->setStartHour( QTime::currentTime ().hour() );
qApp->processEvents();
//qDebug("qApp->processEvents() ");
globalFlagBlockAgenda = 0;
mAgendaView->repaintAgenda();
}
globalFlagBlockAgenda = 0;
}
emit signalAgendaView( mCurrentView == mAgendaView );
//qDebug("raiseCurrentView ende ");
}
void KOViewManager::updateView()
{
// qDebug("KOViewManager::updateView() ");
// if we are updating mTodoView, we get endless recursion
if ( mTodoView == mCurrentView )
return;
if ( mCurrentView ) mCurrentView->updateView();
}
void KOViewManager::updateView(const QDate &start, const QDate &end)
{
// kdDebug() << "KOViewManager::updateView()" << endl;
if (mCurrentView) mCurrentView->showDates(start, end);
- if (mTodoView) mTodoView->updateView();
+ if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
}
void KOViewManager::updateWNview()
{
if ( mCurrentView == mWhatsNextView && mWhatsNextView )
mWhatsNextView->updateView();
}
void KOViewManager::showWhatsNextView()
{
if (!mWhatsNextView) {
mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
"KOViewManager::WhatsNextView");
mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
addView(mWhatsNextView);
connect(this, SIGNAL( printWNV() ),
mWhatsNextView, SLOT( printMe() ) );
}
globalFlagBlockAgenda = 1;
showView(mWhatsNextView, true );
//mWhatsNextView->updateView();
@@ -499,49 +502,51 @@ void KOViewManager::showMonthView()
connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( moveIncidence( Incidence * ) ) );
connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( beamIncidence( Incidence * ) ) );
connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
mMainView, SLOT ( selectWeekNum( int ) ) );
connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
mMainView, SLOT ( showDay( QDate ) ) );
connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
connect( mMonthView, SIGNAL(nextMonth() ),
mMainView->navigatorBar(), SIGNAL(goNextMonth() ) );
connect( mMonthView, SIGNAL(prevMonth() ),
mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) );
mMonthView->updateConfig();
}
globalFlagBlockAgenda = 1;
//mFlagShowNextxDays = false;
// if(mMonthView == mCurrentView) return;
+ mMainView->dateNavigator()->blockSignals( true );
mMainView->dateNavigator()->selectMonth();
+ mMainView->dateNavigator()->blockSignals( false);
// DateList tmpList = mMainView->dateNavigator()->selectedDates( );
//mMonthView->showDates(tmpList.first(), tmpList.last());
showView(mMonthView, true );
}
void KOViewManager::showTodoView()
{
//mFlagShowNextxDays = false;
if ( !mTodoView ) {
mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
"KOViewManager::TodoView" );
addView( mTodoView );
// QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
// SIGNALS/SLOTS FOR TODO VIEW
connect( mTodoView, SIGNAL( newTodoSignal() ),
mMainView, SLOT( newTodo() ) );
connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
mMainView, SLOT( newSubTodo( Todo *) ) );
connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
mMainView, SLOT( showTodo( Todo * ) ) );
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 137eb2d..66ab138 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -47,49 +47,49 @@ using namespace KCal;
class KOViewManager : public QObject
{
Q_OBJECT
public:
KOViewManager( CalendarView * );
virtual ~KOViewManager();
/** changes the view to be the currently selected view */
void showView(KOrg::BaseView *, bool fullScreen = false );
void updateWNview();
void readSettings(KConfig *config);
void writeSettings(KConfig *config);
bool showsNextDays();
/** Read which view was shown last from config file */
void readCurrentView(KConfig *);
/** Write which view is currently shown to config file */
void writeCurrentView(KConfig *);
KOrg::BaseView *currentView();
void setDocumentId( const QString & );
void updateView( const QDate &start, const QDate &end );
- void raiseCurrentView( bool fullScreen = false );
+ void raiseCurrentView( bool fullScreen = false , bool updateView = false);
void addView(KOrg::BaseView *);
Incidence *currentSelection();
QDate currentSelectionDate();
KOAgendaView *agendaView() const { return mAgendaView; }
signals:
void printWNV();
void signalFullScreen( bool );
void signalAgendaView( bool );
public slots:
void showDateView( int, QDate );
void updateView();
void showWhatsNextView();
void showListView();
void showAgendaView( bool fullScreen = false );
void showDayView();
void showWorkWeekView();
void showWeekView();
void showNextXView();
void showMonthView();
void showTodoView();