summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
-rw-r--r--korganizer/koeventpopupmenu.cpp12
-rw-r--r--korganizer/kolistview.cpp7
-rw-r--r--korganizer/koviewmanager.cpp3
-rw-r--r--korganizer/mainwindow.cpp4
5 files changed, 23 insertions, 19 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a10e93c..72221fd 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -653,59 +653,65 @@ CalendarView::~CalendarView()
delete mDateFrame ;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
void CalendarView::setCalReadOnly( int id, bool readO )
{
if ( readO ) {
emit save();
}
mCalendar->setReadOnly( id, readO );
}
void CalendarView::setScrollBarStep(int val )
{
#ifdef DESKTOP_VERSION
mDateScrollBar->setLineStep ( val );
#endif
}
void CalendarView::scrollBarValue(int val )
{
#ifdef DESKTOP_VERSION
if ( QApplication::desktop()->width() < 800 ) return;
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 ) {
+ int stepdays = val;
+ if ( mDateScrollBar->lineStep () <= count ) {
+ val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
+ //qDebug("VAL %d ",val );
+ stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
+ stepdays = day-1+stepdays;
+ if ( stepdays < 0 ) stepdays = 0;
+ }
+ if ( stepdays == day -1 ) {
block = false;
return;
}
+ int year = mNavigator->selectedDates().first().year();
QDate d ( year,1,1 );
- mNavigator->selectDates( d.addDays( val ), count );
+ mNavigator->selectDates( d.addDays( stepdays) , count );
block = false;
#endif
}
void CalendarView::checkFiles()
{
QString message;
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
while ( cal ) {
if ( cal->mErrorOnLoad ) {
message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
}
cal = calendars.next();
}
if ( !message.isEmpty() ) {
message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
}
QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
}
void CalendarView::checkAlarms()
{
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index 0b0fe8e..77322e7 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -40,98 +40,104 @@ KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu()
mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow())));
mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit())));
mEditOnlyItems.append(insertItem (i18n("&Delete..."),
this,SLOT(popupDelete())));
mEditOnlyItems.append(insertItem (i18n("&Clone..."),
this,SLOT(popupClone())));
mEditOnlyItems.append(insertItem (i18n("&Move..."),
this,SLOT(popupMove())));
#ifndef DESKTOP_VERSION
mEditOnlyItems.append(insertItem (i18n("&Beam..."),
this,SLOT(popupBeam())));
#endif
mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"),
this,SLOT(popupCancel())));
isDisabled = false;
mCatPopup = new QPopupMenu ( this );
mCatPopup->setCheckable (true);
connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup()));
connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int )));
mCalPopup = new QPopupMenu ( this );
mCalPopup->setCheckable (true);
connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup()));
connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int )));
- mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup ));
- mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup ));
+ //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup ));
+ //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup ));
+ insertItem (i18n("Categories"),mCatPopup );
+ insertItem (i18n("Calendar"),mCalPopup );
QValueList<int>::Iterator it;
for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
mSingleOnlyItems.append(*it);
}
}
void KOEventPopupMenu::enableDefault( bool enable )
{
isDisabled = !enable;
QValueList<int>::Iterator it;
for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) {
setItemEnabled(*it,enable);
}
}
void KOEventPopupMenu::fillCalPopup() // CAL
{
mCalPopup->clear();
if (!mCurrentIncidence) return;
+ bool readO = mCurrentIncidence->isReadOnly()|| isDisabled;
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber);
- if ( kkf->mErrorOnLoad || kkf->isReadOnly )
+ if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
mCalPopup->setItemEnabled( index, false );
mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID());
kkf = KOPrefs::instance()->mCalendars.next();
}
}
void KOEventPopupMenu::computeCalPopup( int index ) // CAL
{
if (!mCurrentIncidence) return;
mCurrentIncidence->setCalID( index );
emit categoryChanged( mCurrentIncidence );
}
void KOEventPopupMenu::fillCatPopup()
{
mCatPopup->clear();
if (!mCurrentIncidence) return;
+ bool readO = mCurrentIncidence->isReadOnly() || isDisabled;
QStringList checkedCategories = mCurrentIncidence->categories();
int index = 0;
for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
it != KOPrefs::instance()->mCustomCategories.end ();
++it) {
mCatPopup->insertItem (*it, index );
if (checkedCategories.find (*it) != checkedCategories.end ()) {
mCatPopup->setItemChecked (index, true);
}
+ if ( readO )
+ mCatPopup->setItemEnabled( index, false );
++index;
}
}
void KOEventPopupMenu::computeCatPopup( int index )
{
if (!mCurrentIncidence) return;
QStringList categories = mCurrentIncidence->categories();
QString colcat = categories.first();
if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
categories.remove (KOPrefs::instance()->mCustomCategories[index]);
else
categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
categories.sort ();
if ( !colcat.isEmpty() ) {
if ( categories.find ( colcat ) != categories.end () ) {
categories.remove( colcat );
categories.prepend( colcat );
}
}
mCurrentIncidence->setCategories( categories );
emit categoryChanged( mCurrentIncidence );
}
void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
{
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index cec0476..25e599d 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -299,77 +299,77 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
int iii = 0;
for ( iii = 0; iii< 13 ; ++iii )
mListView->setColumnWidthMode( iii, QListView::Manual );
QBoxLayout *layoutTop = new QVBoxLayout(this);
layoutTop->addWidget(mListView);
mListView->setFont ( KOPrefs::instance()->mListViewFont );
mPopupMenu = eventPopup();
QPopupMenu* selPopup = new QPopupMenu ( this );
mPopupMenu->insertSeparator();
selPopup->insertItem(i18n("All"),this,
SLOT(allSelection()));
selPopup->insertItem(i18n("None"),this,
SLOT(clearSelection()));
selPopup->insertItem(i18n("Delete selected..."),this,
SLOT(deleteAll()));
mPopupMenu->insertItem(i18n("Selection"), selPopup );
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Hide all selected"),this,
SLOT(hideAll()),true);
selPopup->insertSeparator();
+ QPopupMenu * exportPO = new QPopupMenu ( this );
+ selPopup->insertItem( i18n("Export"), exportPO );
#ifdef DESKTOP_VERSION
mPopupMenu->insertSeparator();
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Print complete list"),this,
+ i18n("Print complete list..."),this,
SLOT(printList()),true);
#endif
mCalPopup = new QPopupMenu ( this );
selPopup->insertItem( i18n("Set Calendar"), mCalPopup );
selPopup->insertItem(i18n("Set categories")+"...",this,
SLOT(setCat()) );
selPopup->insertItem( i18n("Set alarm..."),this,
SLOT(setAlarm()));
#if 0
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Set categories")+"...",this,
SLOT(setCat()),true);
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Set alarm..."),this,
SLOT(setAlarm()),true);
#endif
QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
SLOT( populateCalPopup() ));
QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
SLOT( setCalendar( int ) ));
QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this,
SLOT( catChanged( Incidence * ) ));
- QPopupMenu * exportPO = new QPopupMenu ( this );
- selPopup->insertItem( i18n("Export"), exportPO );
exportPO->insertItem( i18n("As iCal (ics) file..."),this,
SLOT(saveToFile()));
exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
SLOT(saveToFileVCS()));
exportPO->insertItem( i18n("Journal/Details..."),this,
SLOT(saveDescriptionToFile()));
// mPopupMenu->insertSeparator();
// mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
// i18n("Add Categ. to selected..."),this,
// SLOT(addCat()),true);
//mPopupMenu->insertSeparator();
#ifndef DESKTOP_VERSION
selPopup->insertSeparator();
selPopup->insertItem( i18n("Beam via IR..."),this,
SLOT(beamSelected()));
#if 0
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Beam via IR"),this,
SLOT(beamSelected()),true);
#endif
#endif
/*
mPopupMenu = new QPopupMenu;
mPopupMenu->insertItem(i18n("Edit Event"), this,
@@ -1291,49 +1291,48 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
}
}
}
e->accept();
}
break;
default:
e->ignore();
}
}
KOListViewListView::KOListViewListView(KOListView * lv )
: KListView( lv, "kolistlistview", false )
{
mYMousePos = 0;
mPopupTimer = new QTimer(this);
connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
setSelectionMode( QListView::Multi );
setMultiSelection( true);
}
bool KOListViewListView::hasMultiSelection(QListViewItem* item)
{
- int selCount = 0;
QListViewItem *qitem = firstChild ();
while ( qitem ) {
if ( qitem->isSelected() && item != qitem )
return true;
qitem = qitem->nextSibling();
}
return false;
}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
if (!e) return;
QPoint vp = contentsToViewport(e->pos());
QListViewItem *item = itemAt(vp);
if (!item) {
emit newEvent();
return;
}
KListView::contentsMouseDoubleClickEvent(e);
}
#if 0
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ ");
KListView::contentsMousePressEvent( e );
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 792a7b8..ba3bc05 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -534,86 +534,83 @@ void KOViewManager::showAgendaView( bool fullScreen )
mAgendaView->readSettings();
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;
globalFlagBlockLabel = 1;
globalFlagBlockAgenda = 1;
if ( mCurrentAgendaView != 1 )
mCurrentAgendaView = -1;
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectDates( 1 );
mCurrentAgendaView = 1 ;
- mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showWorkWeekView()
{
mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
mFlagShowNextxDays = false;
globalFlagBlockAgenda = 1;
globalFlagBlockLabel = 1;
if ( mCurrentAgendaView != 5 )
mCurrentAgendaView = -1;
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWorkWeek();
mCurrentAgendaView = 5 ;
- mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showWeekView()
{
mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
mFlagShowNextxDays = false;
globalFlagBlockAgenda = 1;
globalFlagBlockLabel = 1;
if ( mCurrentAgendaView != 7 )
mCurrentAgendaView = -1;
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWeek();
mCurrentAgendaView = 7 ;
- mMainView->setScrollBarStep( 1 );
}
void KOViewManager::showNextXView()
{
KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
globalFlagBlockAgenda = 1;
if ( mCurrentAgendaView != 3 )
mCurrentAgendaView = -1;
showAgendaView(KOPrefs::instance()->mFullViewMonth);
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()
{
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7a5f3e5..5d26d35 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -809,52 +809,48 @@ void MainWindow::initActions()
mView, SLOT( editIncidence() ) );
mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
mDeleteAction->addTo( mCurrentItemMenu );
connect( mDeleteAction, SIGNAL( activated() ),
mView, SLOT( deleteIncidence() ) );
mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
mCloneAction->addTo( mCurrentItemMenu );
connect( mCloneAction, SIGNAL( activated() ),
mView, SLOT( cloneIncidence() ) );
mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
mMoveAction->addTo( mCurrentItemMenu );
connect( mMoveAction, SIGNAL( activated() ),
mView, SLOT( moveIncidence() ) );
mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
mBeamAction->addTo(mCurrentItemMenu );
connect( mBeamAction, SIGNAL( activated() ),
mView, SLOT( beamIncidence() ) );
mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
mCancelAction->addTo( mCurrentItemMenu );
connect( mCancelAction, SIGNAL( activated() ),
mView, SLOT( toggleCancelIncidence() ) );
-#ifdef DESKTOP_VERSION
- actionMenu->insertSeparator();
-#endif
-
QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
ne_action->addTo( actionMenu );
connect( ne_action, SIGNAL( activated() ),
mView, SLOT( newEvent() ) );
icon = loadPixmap( pathString + "newtodo" );
configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
nt_action->addTo( actionMenu );
connect( nt_action, SIGNAL( activated() ),
mView, SLOT( newTodo() ) );
// ***********************
if ( KOPrefs::instance()->mVerticalScreen ) {
icon = SmallIcon( "1updownarrow" );
} else {
icon = SmallIcon("1leftrightarrow" );
}
configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
FSaction->addTo( viewMenu );
connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));