summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp52
-rw-r--r--korganizer/calendarview.h3
-rw-r--r--korganizer/koeventviewer.h0
-rw-r--r--korganizer/koeventviewerdialog.cpp21
-rw-r--r--korganizer/koeventviewerdialog.h6
-rw-r--r--korganizer/kolistview.cpp8
-rw-r--r--korganizer/kolistview.h1
-rw-r--r--korganizer/kotodoview.cpp22
-rw-r--r--korganizer/mainwindow.cpp1
9 files changed, 107 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3dac20b..1009956 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -208,52 +208,56 @@ private:
CalendarView::CalendarView( CalendarResources *calendar,
QWidget *parent, const char *name )
: CalendarViewBase( parent, name ),
mCalendar( calendar ),
mResourceManager( calendar->resourceManager() )
{
mEventEditor = 0;
mTodoEditor = 0;
init();
}
CalendarView::CalendarView( Calendar *calendar,
QWidget *parent, const char *name )
: CalendarViewBase( parent, name ),
mCalendar( calendar ),
mResourceManager( 0 )
{
mEventEditor = 0;
mTodoEditor = 0;
- init();}
+ init();
+}
void CalendarView::init()
{
+
+ setFocusPolicy ( WheelFocus );
+ mViewerCallerIsSearchDialog = false;
mBlockShowDates = false;
beamDialog = new KOBeamPrefs();
mDatePickerMode = 0;
mCurrentSyncDevice = "";
writeLocale();
mViewManager = new KOViewManager( this );
mDialogManager = new KODialogManager( this );
mEventViewerDialog = 0;
mModified = false;
mReadOnly = false;
mSelectedIncidence = 0;
mCalPrinter = 0;
mFilters.setAutoDelete(true);
mCalendar->registerObserver( this );
// TODO: Make sure that view is updated, when calendar is changed.
mStorage = new FileStorage( mCalendar );
mNavigator = new DateNavigator( this, "datevav", mViewManager );
QBoxLayout *topLayout = (QBoxLayout*)layout();
#ifndef KORG_NOSPLITTER
// create the main layout frames.
mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
@@ -2599,48 +2603,49 @@ void CalendarView::cloneIncidence(Incidence * orgInc )
newInc->recreate();
if ( newInc->type() == "Todo" ) {
Todo* t = (Todo*) newInc;
showTodoEditor();
mTodoEditor->editTodo( t );
if ( mTodoEditor->exec() ) {
mCalendar->addTodo( t );
updateView();
} else {
delete t;
}
}
else {
Event* e = (Event*) newInc;
showEventEditor();
mEventEditor->editEvent( e );
if ( mEventEditor->exec() ) {
mCalendar->addEvent( e );
updateView();
} else {
delete e;
}
}
+ setActiveWindow();
}
void CalendarView::newEvent()
{
// TODO: Replace this code by a common eventDurationHint of KOBaseView.
KOAgendaView *aView = mViewManager->agendaView();
if (aView) {
if (aView->selectionStart().isValid()) {
if (aView->selectedIsAllDay()) {
newEvent(aView->selectionStart(),aView->selectionEnd(),true);
} else {
newEvent(aView->selectionStart(),aView->selectionEnd());
}
return;
}
}
QDate date = mNavigator->selectedDates().first();
QDateTime current = QDateTime::currentDateTime();
if ( date <= current.date() ) {
int hour = current.time().hour() +1;
newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
} else
@@ -2656,155 +2661,168 @@ void CalendarView::newEvent(QDateTime fh)
}
void CalendarView::newEvent(QDate dt)
{
newEvent(QDateTime(dt, QTime(0,0,0)),
QDateTime(dt, QTime(0,0,0)), true);
}
void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
{
newEvent(fromHint, toHint, false);
}
void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
{
showEventEditor();
mEventEditor->newEvent(fromHint,toHint,allDay);
if ( mFilterView->filtersEnabled() ) {
CalFilter *filter = mFilterView->selectedFilter();
if (filter && filter->showCategories()) {
mEventEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mEventEditor->setSecrecy( filter->getSecrecy() );
}
+ mEventEditor->exec();
+ setActiveWindow();
}
void CalendarView::todoAdded(Todo * t)
{
changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
updateTodoViews();
}
void CalendarView::todoChanged(Todo * t)
{
emit todoModified( t, 4 );
// updateTodoViews();
}
void CalendarView::todoToBeDeleted(Todo *)
{
//qDebug("todoToBeDeleted(Todo *) ");
updateTodoViews();
}
void CalendarView::todoDeleted()
{
//qDebug(" todoDeleted()");
updateTodoViews();
}
void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
{
showTodoEditor();
mTodoEditor->newTodo(dt,0,allday);
if ( mFilterView->filtersEnabled() ) {
CalFilter *filter = mFilterView->selectedFilter();
if (filter && filter->showCategories()) {
mTodoEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mTodoEditor->setSecrecy( filter->getSecrecy() );
}
+ mTodoEditor->exec();
+ setActiveWindow();
}
void CalendarView::newTodo()
{
newTodoDateTime( QDateTime(),true );
}
void CalendarView::newSubTodo()
{
Todo *todo = selectedTodo();
if ( todo ) newSubTodo( todo );
}
void CalendarView::newSubTodo(Todo *parentEvent)
{
showTodoEditor();
mTodoEditor->newTodo(QDateTime(),parentEvent,true);
+ mTodoEditor->exec();
+ setActiveWindow();
}
void CalendarView::newFloatingEvent()
{
DateList tmpList = mNavigator->selectedDates();
QDate date = tmpList.first();
newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
QDateTime( date, QTime( 12, 0, 0 ) ), true );
}
void CalendarView::editEvent( Event *event )
{
if ( !event ) return;
if ( event->isReadOnly() ) {
showEvent( event );
return;
}
showEventEditor();
mEventEditor->editEvent( event , mFlagEditDescription);
+ mEventEditor->exec();
+ setActiveWindow();
+
}
void CalendarView::editJournal( Journal *jour )
{
if ( !jour ) return;
mDialogManager->hideSearchDialog();
mViewManager->showJournalView();
mNavigator->slotDaySelect( jour->dtStart().date() );
}
void CalendarView::editTodo( Todo *todo )
{
if ( !todo ) return;
if ( todo->isReadOnly() ) {
showTodo( todo );
return;
}
showTodoEditor();
mTodoEditor->editTodo( todo ,mFlagEditDescription);
+ mTodoEditor->exec();
+ setActiveWindow();
}
KOEventViewerDialog* CalendarView::getEventViewerDialog()
{
if ( !mEventViewerDialog ) {
mEventViewerDialog = new KOEventViewerDialog(this);
connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
viewManager(), SLOT( showAgendaView( bool ) ) );
+ connect( mEventViewerDialog, SIGNAL(signalViewerClosed()),
+ this, SLOT( slotViewerClosed() ) );
connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
this, SLOT( todoChanged(Todo *) ) );
mEventViewerDialog->resize( 640, 480 );
}
return mEventViewerDialog;
}
void CalendarView::showEvent(Event *event)
{
getEventViewerDialog()->setEvent(event);
getEventViewerDialog()->showMe();
}
void CalendarView::showTodo(Todo *event)
{
getEventViewerDialog()->setTodo(event);
getEventViewerDialog()->showMe();
}
void CalendarView::showJournal( Journal *jour )
{
getEventViewerDialog()->setJournal(jour);
getEventViewerDialog()->showMe();
}
@@ -3717,83 +3735,91 @@ void CalendarView::calendarModified( bool modified, Calendar * )
}
Todo *CalendarView::selectedTodo()
{
Incidence *incidence = currentSelection();
if ( incidence && incidence->type() == "Todo" ) {
return static_cast<Todo *>( incidence );
}
incidence = mTodoList->selectedIncidences().first();
if ( incidence && incidence->type() == "Todo" ) {
return static_cast<Todo *>( incidence );
}
return 0;
}
void CalendarView::dialogClosing(Incidence *in)
{
// mDialogList.remove(in);
}
void CalendarView::showIncidence()
{
+ mViewerCallerIsSearchDialog = false;
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
ShowIncidenceVisitor v;
v.act( incidence, this );
}
}
void CalendarView::editIncidenceDescription()
{
mFlagEditDescription = true;
editIncidence();
mFlagEditDescription = false;
}
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)
{
+ mViewerCallerIsSearchDialog = false;
+ //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
+ if ( sender() && mDialogManager->getSearchDialog() ) {
+ if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
+ mViewerCallerIsSearchDialog = true;
+ }
+ }
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 );
}
}
@@ -3901,24 +3927,48 @@ void CalendarView::setSyncManager(KSyncManager* manager)
void CalendarView::removeSyncInfo( QString syncProfile)
{
qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
mCalendar->removeSyncInfo( syncProfile );
}
void CalendarView::undo_delete()
{
//qDebug("undo_delete() ");
Incidence* undo = mCalendar->undoIncidence();
if ( !undo ) {
KMessageBox::sorry(this,i18n("There is nothing to undo!"),
i18n("KO/Pi"));
return;
}
if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
i18n("\nAre you sure you want\nto restore this?"),
i18n("KO/Pi Confirmation"),i18n("Restore"))) {
mCalendar->undoDeleteIncidence();
updateView();
}
}
+
+void CalendarView::slotViewerClosed()
+{
+ QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
+}
+
+void CalendarView::resetFocus()
+{
+ if ( mViewerCallerIsSearchDialog ) {
+ if ( mDialogManager->getSearchDialog()->isVisible() ){
+ mDialogManager->getSearchDialog()->raise();
+ mDialogManager->getSearchDialog()->setActiveWindow();
+ mDialogManager->getSearchDialog()->listview()->resetFocus();
+ } else
+ mViewerCallerIsSearchDialog = false;
+ }
+ if ( !mViewerCallerIsSearchDialog ) {
+ //mViewManager->currentView()->setFocus();
+ //qDebug("sssssssssssssssset focus ");
+ setActiveWindow();
+ //setFocus();
+ }
+ mViewerCallerIsSearchDialog = false;
+}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index e626ea3..664d700 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -435,87 +435,90 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
bool removeCompletedSubTodos( Todo* );
void slotCalendarChanged();
bool importBday();
bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
bool importQtopia( const QString &categoriesFile,
const QString &datebookFile,
const QString &tasklistFile );
void syncExternal( int mode );
void slotSelectPickerDate( QDate ) ;
void showDatePicker() ;
void showDatePickerPopup() ;
void moveIncidence(Incidence *) ;
void beamIncidence(Incidence *) ;
void beamCalendar() ;
void beamFilteredCalendar() ;
void beamIncidenceList(QPtrList<Incidence>) ;
void manageCategories();
int addCategories();
void removeCategories();
void setSyncDevice( QString );
void setSyncName( QString );
void showDay( QDate );
void undo_delete();
protected slots:
+ void resetFocus();
+ void slotViewerClosed();
void timerAlarm();
void suspendAlarm();
void beamDone( Ir *ir );
/** Select a view or adapt the current view to display the specified dates. */
void showDates( const KCal::DateList & );
void selectWeekNum ( int );
public:
// show a standard warning
// returns KMsgBox::yesNoCancel()
int msgCalModified();
virtual bool sync(KSyncManager* manager, QString filename, int mode);
virtual bool syncExternal(KSyncManager* manager, QString resource);
virtual void removeSyncInfo( QString syncProfile);
void setSyncManager(KSyncManager* manager);
void setLoadedFileVersion(QDateTime);
bool checkFileVersion(QString fn);
bool checkFileChanged(QString fn);
Event* getLastSyncEvent();
/** Adapt navigation units correpsonding to step size of navigation of the
* current view.
*/
void adaptNavigationUnits();
bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
//Attendee* getYourAttendee(Event *event);
void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
protected:
void schedule(Scheduler::Method, Incidence *incidence = 0);
// returns KMsgBox::OKCandel()
int msgItemDelete(const QString name);
void showEventEditor();
void showTodoEditor();
void writeLocale();
Todo *selectedTodo();
private:
+ bool mViewerCallerIsSearchDialog;
bool mBlockShowDates;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
void setSyncEventsReadOnly();
QDateTime loadedFileVersion;
void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
void checkExternalId( Incidence * inc );
int mGlobalSyncMode;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
KOBeamPrefs* beamDialog;
void init();
int mDatePickerMode;
bool mFlagEditDescription;
QDateTime mLastCalendarSync;
void createPrinter();
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index d8142ca..2d4a08e 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 23e62d3..8bada3b 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -1,66 +1,67 @@
/*
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 <qtimer.h>
#include <qpushbutton.h>
#include "koeventviewer.h"
#include "koprefs.h"
#include <libkcal/todo.h>
#include "qapp.h"
#include "koeventviewerdialog.h"
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"))
{
-
+ sendSignalViewerClosed = true;
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;
}
@@ -168,63 +169,64 @@ void KOEventViewerDialog::setTodo(Todo *event)
//findButton( Close )->setFocus();
if ( !mSyncMode ) {
findButton( User1 )->setText( i18n("Set complete"));
}
}
void KOEventViewerDialog::setJournal(Journal *j)
{
mEventViewer->setJournal(j);
mIncidence = (Incidence*)j;
mEventViewer->setFocus();
//findButton( Close )->setFocus();
if ( !mSyncMode ) {
findButton( User1 )->setText( i18n("Agenda"));
}
}
void KOEventViewerDialog::addText(QString text)
{
mEventViewer->addText(text);
mEventViewer->setFocus();
//findButton( Close )->setFocus();
}
void KOEventViewerDialog::editIncidence()
{
+ sendSignalViewerClosed = false;
if ( mSyncMode ) {
mSyncResult = 2;
accept();
return;
}
if ( mIncidence ){
#ifndef DESKTOP_VERSION
hide();
#endif
emit editIncidence( mIncidence );
}
}
void KOEventViewerDialog::showIncidence()
{
-
+ sendSignalViewerClosed = false;
if ( mSyncMode ) {
mSyncResult = 1;
accept();
return;
}
if ( mIncidence ){
#ifndef DESKTOP_VERSION
hide();
#endif
QDate date;
if ( mIncidence->type() == "Todo" ) {
/*
if ( ((Todo*)mIncidence)->hasDueDate() )
date = ((Todo*)mIncidence)->dtDue().date();
else {
globalFlagBlockAgenda = 2;
emit showAgendaView( false );
return;
}
*/
((Todo*)mIncidence)->setCompleted( true );
((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
hide();
@@ -243,24 +245,39 @@ void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
{
switch ( e->key() ) {
case Qt::Key_A :
case Qt::Key_L :
showIncidence();
break;
case Qt::Key_E :
case Qt::Key_R :
editIncidence();
break;
case Qt::Key_C:
case Qt::Key_Escape:
close();
break;
case Qt::Key_I:
accept();
break;
default:
KDialogBase::keyPressEvent ( e );
break;
}
}
+void KOEventViewerDialog::hideEvent ( QHideEvent * e )
+{
+ KDialogBase::hideEvent ( e );
+ QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) );
+}
+
+void KOEventViewerDialog::slotViewerClosed()
+{
+ if ( sendSignalViewerClosed ) {
+ //qDebug("KOEventViewerDialog::hideEvent ");
+ emit signalViewerClosed();
+ }
+ sendSignalViewerClosed = true;
+}
+
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h
index b6b4103..36431ad 100644
--- a/korganizer/koeventviewerdialog.h
+++ b/korganizer/koeventviewerdialog.h
@@ -35,37 +35,41 @@ class KOEventViewer;
class KOEventViewerDialog : public KDialogBase {
Q_OBJECT
public:
KOEventViewerDialog(QWidget *parent=0,const char *name=0);
virtual ~KOEventViewerDialog();
void setEvent(Event *event);
void addEvent(Event *event);
void setTodo(Todo *event);
void setJournal(Journal *journal);
void setIncidence(Incidence *inc);
void addIncidence(Incidence *inc);
void addText(QString text);
void showMe();
void setSyncMode( bool );
void setColorMode( int m );
int executeS( bool );
public slots:
void updateConfig();
signals:
void editIncidence( Incidence* );
void jumpToTime( const QDate &);
void showAgendaView( bool );
void todoCompleted(Todo*);
+ void signalViewerClosed();
private slots:
+ void slotViewerClosed();
void editIncidence();
void showIncidence();
-
+ protected:
+ void hideEvent ( QHideEvent * e );
private:
+ bool sendSignalViewerClosed;
bool mSyncMode;
int mSyncResult;
KOEventViewer *mEventViewer;
Incidence* mIncidence;
void keyPressEvent ( QKeyEvent * e );
};
#endif
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 4a6e17d..6acee75 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -763,49 +763,52 @@ void KOListView::showDates(bool show)
} else {
mListView->setColumnWidth(1, oldColWidth1);
mListView->setColumnWidth(3, oldColWidth3);
}
mListView->repaint();
}
void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Day, fd, td);
#endif
}
void KOListView::showDates()
{
showDates(true);
}
void KOListView::hideDates()
{
showDates(false);
}
-
+void KOListView::resetFocus()
+{
+ mListView->setFocus();
+}
void KOListView::updateView()
{
mListView->setFocus();
if ( mListView->firstChild () )
mListView->setCurrentItem( mListView->firstChild () );
}
void KOListView::updateConfig()
{
mListView->setFont ( KOPrefs::instance()->mListViewFont );
updateView();
}
void KOListView::setStartDate(const QDate &start)
{
mStartDate = start;
}
void KOListView::showDates(const QDate &start, const QDate &end)
{
clear();
mStartDate = start;
QDate date = start;
QPtrList<Journal> j_list;
@@ -1054,53 +1057,54 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
int count = childCount ();
int jump = count / 5;
QListViewItem* cn;
cn = currentItem();
if ( ! cn )
return;
if ( jump == 0 )
jump = 1;
while ( jump && cn->itemAbove ()) {
cn = cn->itemAbove ();
--jump;
}
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else
QListView::keyPressEvent ( e ) ;
e->accept();
break;
case Qt::Key_I: {
QListViewItem* cn;
cn = currentItem();
if ( cn ) {
KOListViewItem* ci = (KOListViewItem*)( cn );
if ( ci ){
- emit showIncidence( ci->data());
+ //emit showIncidence( ci->data());
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
+ emit showIncidence( ci->data());
}
}
}
e->accept();
}
break;
case Qt::Key_Return:
case Qt::Key_Enter:
{
QListViewItem* cn;
cn = currentItem();
if ( cn ) {
KOListViewItem* ci = (KOListViewItem*)( cn );
if ( ci ){
if ( e->state() == ShiftButton )
ci->setSelected( false );
else
ci->setSelected( true );
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
}
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index bd5bd12..c86449d 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -233,48 +233,49 @@ class KOListView : public KOEventView
Q_OBJECT
public:
KOListView(Calendar *calendar, QWidget *parent = 0,
const char *name = 0);
~KOListView();
virtual int maxDatesHint();
virtual int currentDateCount();
virtual QPtrList<Incidence> selectedIncidences();
virtual DateList selectedDates();
void showDates(bool show);
Incidence* currentItem();
void addTodos(QPtrList<Todo> eventList);
void addJournals(QPtrList<Journal> eventList);
virtual void printPreview(CalPrinter *calPrinter,
const QDate &, const QDate &);
void readSettings(KConfig *config, QString setting = "KOListView Layout");
void writeSettings(KConfig *config, QString setting = "KOListView Layout");
void updateList();
void setStartDate(const QDate &start);
int count();
QString getWhatsThisText(QPoint p);
+ void resetFocus();
signals:
void signalNewEvent();
void beamIncidenceList(QPtrList<Incidence>);
public slots:
virtual void updateView();
virtual void showDates(const QDate &start, const QDate &end);
virtual void showEvents(QPtrList<Event> eventList);
void clearSelection();
void allSelection();
void clear();
void beamDone( Ir *ir );
void showDates();
void hideDates();
void deleteAll();
void saveToFile();
void saveDescriptionToFile();
void beamSelected();
void updateConfig();
void addCat();
void setCat();
void setAlarm();
void setCategories( bool removeOld );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 3483e95..5e8ea27 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -584,48 +584,53 @@ void KOTodoView::paintEvent(QPaintEvent * pevent)
updateView();
mPendingUpdateBeforeRepaint = false;
}
KOrg::BaseView::paintEvent( pevent);
}
void KOTodoView::updateView()
{
pendingSubtodo = 0;
if ( mBlockUpdate ) {
return;
}
if ( !isVisible() ) {
mPendingUpdateBeforeRepaint = true;
return;
}
//qDebug("KOTodoView::updateView() %x", this);
if ( isFlatDisplay ) {
displayAllFlat();
return;
}
//qDebug("update ");
// kdDebug() << "KOTodoView::updateView()" << endl;
QFont fo = KOPrefs::instance()->mTodoViewFont;
+ Incidence* oldInc = 0;
+ mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
+ if (mActiveItem)
+ oldInc = mActiveItem->todo();
+
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;
Event *t;
for(t = todoList.first(); t; t = todoList.next()) {
kdDebug() << " " << t->getSummary() << endl;
if (t->getRelatedTo()) {
kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
}
@@ -665,48 +670,65 @@ void KOTodoView::updateView()
} else
incidence = 0;
}
if ( next )
todo = todoList.next();
}
// qDebug("again .... ");
// for(todo = todoList.first(); todo; todo = todoList.next()) {
// qDebug("yytodo %s ", todo->summary().latin1());
// }
//qDebug("for ");
for(todo = todoList.first(); todo; todo = todoList.next()) {
if (!mTodoMap.contains(todo) && checkTodo( todo ) )
{
insertTodoItem(todo);
}
}
//qDebug("for end ");
// Restore opened/closed state
mTodoListView->blockSignals( true );
if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
mTodoListView->blockSignals( false );
mTodoListView->setFocus();
+ if ( mTodoListView->firstChild () ) {
+ if ( oldInc ) {
+ KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
+ while ( item ) {
+ if ( item->todo() == oldInc ) {
+ mTodoListView->setCurrentItem( item );
+ mTodoListView->ensureItemVisible( item );
+ break;
+ }
+ item = (KOTodoViewItem*)item->itemBelow();
+ }
+ if ( ! item )
+ mTodoListView->setCurrentItem( mTodoListView->firstChild () );
+ } else {
+ mTodoListView->setCurrentItem( mTodoListView->firstChild () );
+ }
+ }
processSelectionChange();
}
bool KOTodoView::checkTodo( Todo * todo )
{
if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
return false;
if ( !todo->isCompleted() ) {
if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
return true;
}
if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
if ( todo->hasStartDate() )
if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
return false;
if ( todo->hasDueDate() )
if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
return false;
}
return true;
}
void KOTodoView::restoreItemState( QListViewItem *item )
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 4f2cccf..2de7f28 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -266,49 +266,48 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mSyncManager->fillSyncMenu();
mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
if ( showWarning ) {
KMessageBox::information( this,
"You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
qApp->processEvents();
mView->dialogManager()->showSyncOptions();
}
//US listen for result adressed from Ka/Pi
#ifndef DESKTOP_VERSION
connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
#endif
#ifndef DESKTOP_VERSION
infrared = 0;
#endif
updateWeek( mView->startDate() );
connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
SLOT( updateWeekNum( const KCal::DateList & ) ) );
mBRdisabled = false;
//toggleBeamReceive();
- setFocusPolicy ( WheelFocus );
}
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
delete mSyncManager;
#ifndef DESKTOP_VERSION
if ( infrared )
delete infrared;
#endif
}
void MainWindow::disableBR(bool b)
{
#ifndef DESKTOP_VERSION
if ( b ) {
if ( infrared ) {
toggleBeamReceive();
mBRdisabled = true;
}
mBRdisabled = true;