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
@@ -367,12 +367,11 @@ 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;
@@ -444,9 +443,11 @@ void CalendarView::init()
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
@@ -467,8 +468,9 @@ void CalendarView::init()
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);
@@ -641,12 +643,35 @@ 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" );
@@ -2466,29 +2491,11 @@ 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();
@@ -2576,8 +2583,9 @@ 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();
}
@@ -2843,9 +2851,11 @@ void CalendarView::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
@@ -2855,9 +2865,9 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
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();
@@ -2879,9 +2889,9 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
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 {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index be18e8f..c89bbf7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -29,8 +29,9 @@
#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
@@ -491,8 +492,9 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void showDay( QDate );
void undo_delete();
protected slots:
void resetFocus();
+ void scrollBarValue(int);
void slotViewerClosed();
void timerAlarm();
void suspendAlarm();
void beamDone( Ir *ir );
@@ -521,19 +523,20 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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;
@@ -552,9 +555,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void checkExternalId( Incidence * inc );
int mGlobalSyncMode;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
- KOBeamPrefs* beamDialog;
void init();
int mDatePickerMode;
bool mFlagEditDescription;
QDateTime mLastCalendarSync;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 7b307f7..bd191d8 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -467,8 +467,9 @@ void KOViewManager::showListView()
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 )
{
@@ -534,8 +535,9 @@ void KOViewManager::showAgendaView( bool fullScreen )
KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
showView( mAgendaView, full);
KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showDayView()
{
@@ -550,8 +552,9 @@ void KOViewManager::showDayView()
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectDates( 1 );
mCurrentAgendaView = 1 ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showWorkWeekView()
@@ -567,8 +570,9 @@ void KOViewManager::showWorkWeekView()
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWorkWeek();
mCurrentAgendaView = 5 ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showWeekView()
@@ -585,8 +589,9 @@ void KOViewManager::showWeekView()
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWeek();
mCurrentAgendaView = 7 ;
+ mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showNextXView()
{
@@ -601,8 +606,9 @@ void KOViewManager::showNextXView()
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
mCurrentAgendaView = 3 ;
KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
+ mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays );
}
bool KOViewManager::showsNextDays()
{
return mFlagShowNextxDays;
@@ -694,8 +700,9 @@ void KOViewManager::showMonthViewWeek()
mMainView->dateNavigator()->selectWeek();
showView(mMonthView, full );
mMonthView->setKeyBFocus();
KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
+ mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showMonth( const QDate & date )
{
@@ -726,8 +733,9 @@ void KOViewManager::showMonthView()
showView(mMonthView, full );
mMonthView->setKeyBFocus();
KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
+ mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showTodoView()
@@ -783,8 +791,9 @@ 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()
@@ -802,8 +811,9 @@ 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()
{