summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp60
-rw-r--r--korganizer/calendarview.h8
-rw-r--r--korganizer/koviewmanager.cpp10
3 files changed, 50 insertions, 28 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 697093e..776cdd3 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -365,16 +365,15 @@ CalendarView::CalendarView( Calendar *calendar,
void CalendarView::init()
{
mNextAlarmDateTime = QDateTime::currentDateTime();
setFocusPolicy ( NoFocus );
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;
@@ -442,13 +441,15 @@ void CalendarView::init()
mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
}
mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
//QBoxLayout * leftFrameLayout;
+ mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
topLayout->addWidget( mMainFrame );
+ topLayout->addWidget( mDateScrollBar );
//mainBoxLayout->addWidget (mLeftFrame);
mDateNavigator = new DateNavigatorContainer( mLeftFrame,
"CalendarView::DateNavigator" );
#if 0
// FIXME
mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
@@ -465,12 +466,13 @@ void CalendarView::init()
connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
+ connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
mTodoList->setNavigator( mNavigator );
#if 0
if ( QApplication::desktop()->width() < 480 ) {
leftFrameLayout->addWidget(mFilterView);
leftFrameLayout->addWidget(mTodoList, 2 );
@@ -639,16 +641,39 @@ CalendarView::~CalendarView()
// kdDebug() << "~CalendarView()" << endl;
//qDebug("CalendarView::~CalendarView() ");
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
- delete beamDialog;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
+void CalendarView::setScrollBarStep(int val )
+{
+ mDateScrollBar->setLineStep ( val );
+}
+void CalendarView::scrollBarValue(int val )
+{
+ static bool block = false;
+ if ( block ) return;
+ block = true;
+ val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
+ //qDebug("VAL %d ",val );
+ int count = mNavigator->selectedDates().count();
+ int year = mNavigator->selectedDates().first().year();
+ int day = mNavigator->selectedDates().first().dayOfYear();
+ if ( val == day -1 ) {
+ block = false;
+ return;
+ }
+ QDate d ( year,1,1 );
+ mNavigator->selectDates( d.addDays( val ), count );
+ block = false;
+
+}
+
void CalendarView::checkAlarms()
{
KConfig *config = KOGlobals::config();
config->setGroup( "AppRun" );
QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
int daysto = dt.daysTo( QDate::currentDate() );
@@ -2464,33 +2489,15 @@ void CalendarView::goNextMonth()
}
void CalendarView::goPreviousMonth()
{
mNavigator->selectPreviousMonth();
}
-void CalendarView::writeLocale()
-{
- //KPimGlobalPrefs::instance()->setGlobalConfig();
-#if 0
- KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
- KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
- KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
- KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
- QString dummy = KOPrefs::instance()->mUserDateFormatLong;
- KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
- dummy = KOPrefs::instance()->mUserDateFormatShort;
- KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
- KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
- KOPrefs::instance()->mDaylightsavingStart,
- KOPrefs::instance()->mDaylightsavingEnd );
- KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
-#endif
-}
+
void CalendarView::updateConfig()
{
- writeLocale();
if ( KOPrefs::instance()->mUseAppColors )
QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
emit configChanged();
mTodoList->updateConfig();
// mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
@@ -2574,12 +2581,13 @@ void CalendarView::updateTodoViews()
}
void CalendarView::updateView(const QDate &start, const QDate &end)
{
+ mDateScrollBar->setValue( start.dayOfYear()-1);
mTodoList->updateView();
mViewManager->updateView(start, end);
//mDateNavigator->updateView();
}
void CalendarView::clearAllViews()
@@ -2841,25 +2849,27 @@ void CalendarView::beamFilteredCalendar()
QPtrList<Incidence> delSel = mCalendar->incidences();
//qDebug("beamFilteredCalendar() ");
beamIncidenceList( delSel );
}
void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
{
- if ( beamDialog->exec () == QDialog::Rejected )
+
+ KOBeamPrefs beamDialog;
+ if ( beamDialog.exec () == QDialog::Rejected )
return;
#ifdef DESKTOP_VERSION
QString fn = locateLocal( "tmp", "kopibeamfile" );
#else
QString fn = "/tmp/kopibeamfile";
#endif
QString mes;
bool createbup = true;
if ( createbup ) {
QString description = "\n";
CalendarLocal* cal = new CalendarLocal();
- if ( beamDialog->beamLocal() )
+ if ( beamDialog.beamLocal() )
cal->setLocalTime();
else
cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
Incidence *incidence = delSel.first();
bool addText = false;
if ( delSel.count() < 10 )
@@ -2877,13 +2887,13 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
}
if ( addText )
description += in->summary() + "\n";
cal->addIncidence( in );
incidence = delSel.next();
}
- if ( beamDialog->beamVcal() ) {
+ if ( beamDialog.beamVcal() ) {
fn += ".vcs";
FileStorage storage( cal, fn, new VCalFormat );
storage.save();
} else {
fn += ".ics";
FileStorage storage( cal, fn, new ICalFormat( ) );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index be18e8f..c89bbf7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -27,12 +27,13 @@
#include <qframe.h>
#include <qlayout.h>
#include <qwidget.h>
#include <qptrlist.h>
#include <qvbox.h>
#include <qmap.h>
+#include <qscrollbar.h>
#ifndef DESKTOP_VERSION
#include <qtopia/ir.h>
#else
#define Ir char
#endif
#include <libkcal/calendar.h>
@@ -489,12 +490,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void setSyncDevice( QString );
void setSyncName( QString );
void showDay( QDate );
void undo_delete();
protected slots:
void resetFocus();
+ void scrollBarValue(int);
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 & );
@@ -519,23 +521,24 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
*/
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 ;}
+ void setScrollBarStep(int val );
+
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:
+ QScrollBar * mDateScrollBar;
QDateTime mNextAlarmDateTime;
bool mViewerCallerIsSearchDialog;
bool mBlockShowDates;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
@@ -550,13 +553,12 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 7b307f7..bd191d8 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -465,12 +465,13 @@ void KOViewManager::showListView()
mMainView->setBlockShowDates( false );
}
KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
showView(mListView, KOPrefs::instance()->mFullViewTodo);
//mFlagShowNextxDays = temp;
KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
+ mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showAgendaView( bool fullScreen )
{
mMainView->dialogManager()->hideSearchDialog();
@@ -532,12 +533,13 @@ void KOViewManager::showAgendaView( bool fullScreen )
mAgendaView->updateConfig();
}
KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
showView( mAgendaView, full);
KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showDayView()
{
mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
mFlagShowNextxDays = false;
@@ -548,12 +550,13 @@ void KOViewManager::showDayView()
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectDates( 1 );
mCurrentAgendaView = 1 ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showWorkWeekView()
{
mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
@@ -565,12 +568,13 @@ void KOViewManager::showWorkWeekView()
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWorkWeek();
mCurrentAgendaView = 5 ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showWeekView()
{
@@ -583,12 +587,13 @@ void KOViewManager::showWeekView()
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWeek();
mCurrentAgendaView = 7 ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showNextXView()
{
KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
@@ -599,12 +604,13 @@ void KOViewManager::showNextXView()
globalFlagBlockAgenda = 2;
mMainView->dateNavigator()->selectDates( QDate::currentDate(),
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
mCurrentAgendaView = 3 ;
KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
+ mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays );
}
bool KOViewManager::showsNextDays()
{
return mFlagShowNextxDays;
}
void KOViewManager::createMonthView()
@@ -692,12 +698,13 @@ void KOViewManager::showMonthViewWeek()
full = true;
}
mMainView->dateNavigator()->selectWeek();
showView(mMonthView, full );
mMonthView->setKeyBFocus();
KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
+ mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showMonth( const QDate & date )
{
mMainView->dateNavigator()->blockSignals( true );
mMainView->dateNavigator()->selectDate( date );
@@ -724,12 +731,13 @@ void KOViewManager::showMonthView()
}
mMainView->dateNavigator()->selectMonth();
showView(mMonthView, full );
mMonthView->setKeyBFocus();
KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
+ mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showTodoView()
{
//mFlagShowNextxDays = false;
@@ -781,12 +789,13 @@ void KOViewManager::showTodoView()
}
KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
globalFlagBlockAgenda = 1;
showView( mTodoView, true );
KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
+ mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showJournalView()
{
//mFlagShowNextxDays = false;
@@ -800,12 +809,13 @@ void KOViewManager::showJournalView()
}
KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
showView(mJournalView);
mMainView->dateNavigator()->selectDates( 1 );
KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showTimeSpanView()
{
//mFlagShowNextxDays = false;
if (!mTimeSpanView) {