summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-01 20:33:17 (UTC)
committer zautrix <zautrix>2005-07-01 20:33:17 (UTC)
commit541878bcf52030d8597d5e79afb6ae1185b2ac2c (patch) (side-by-side diff)
treec6aeb2861062f1bfcc6ba10ec6e26b058205a1cd /korganizer
parentc53efbe8f53f468d21d93f5e19b625d1a4beb242 (diff)
downloadkdepimpi-541878bcf52030d8597d5e79afb6ae1185b2ac2c.zip
kdepimpi-541878bcf52030d8597d5e79afb6ae1185b2ac2c.tar.gz
kdepimpi-541878bcf52030d8597d5e79afb6ae1185b2ac2c.tar.bz2
fixixixis
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp155
-rw-r--r--korganizer/kolistview.h7
-rw-r--r--korganizer/koprefs.cpp2
-rw-r--r--korganizer/koviewmanager.cpp2
4 files changed, 50 insertions, 116 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index e5e3704..4c815d8 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -277,86 +277,83 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
mListView->setColumnAlignment(6,AlignLeft);
mListView->setColumnAlignment(7,AlignLeft);
mListView->setColumnAlignment(8,AlignLeft);
mListView->setColumnAlignment(9,AlignLeft);
mListView->setColumnAlignment(10,AlignLeft);
mListView->setColumnAlignment(11,AlignLeft);
mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
int iii = 0;
for ( iii = 0; iii< 12 ; ++iii )
mListView->setColumnWidthMode( iii, QListView::Manual );
QBoxLayout *layoutTop = new QVBoxLayout(this);
layoutTop->addWidget(mListView);
mListView->setFont ( KOPrefs::instance()->mListViewFont );
mPopupMenu = eventPopup();
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Select all"),this,
- SLOT(allSelection()),true);
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Deselect all"),this,
- SLOT(clearSelection()),true);
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Delete all selected"),this,
- SLOT(deleteAll()),true);
-
+ 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);
mPopupMenu->insertSeparator();
#ifdef DESKTOP_VERSION
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Print complete list"),this,
SLOT(printList()),true);
mPopupMenu->insertSeparator();
#endif
mCalPopup = new QPopupMenu ( this );
mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup );
+ mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ i18n("Set categories")+"...",this,
+ SLOT(setCat()),true);
+ mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ i18n("Set alarm..."),this,
+ SLOT(setAlarm()),true);
QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
SLOT( populateCalPopup() ));
QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
SLOT( setCalendar( int ) ));
QPopupMenu * exportPO = new QPopupMenu ( this );
- mPopupMenu->insertItem( i18n("Export selected"), exportPO );
+ mPopupMenu->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->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Set Categ. for selected..."),this,
- SLOT(setCat()),true);
+ // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ // i18n("Add Categ. to selected..."),this,
+ // SLOT(addCat()),true);
//mPopupMenu->insertSeparator();
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Set alarm for selected..."),this,
- SLOT(setAlarm()),true);
-
-
-
#ifndef DESKTOP_VERSION
mPopupMenu->insertSeparator();
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
- i18n("Beam selected via IR"),this,
+ i18n("Beam via IR"),this,
SLOT(beamSelected()),true);
#endif
/*
mPopupMenu = new QPopupMenu;
mPopupMenu->insertItem(i18n("Edit Event"), this,
SLOT (editEvent()));
mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
SLOT (deleteEvent()));
mPopupMenu->insertSeparator();
mPopupMenu->insertItem(i18n("Show Dates"), this,
SLOT(showDates()));
mPopupMenu->insertItem(i18n("Hide Dates"), this,
SLOT(hideDates()));
*/
QObject::connect(mListView,SIGNAL( newEvent()),
this,SIGNAL(signalNewEvent()));
@@ -425,63 +422,68 @@ void KOListView::setCalendar( int c )
mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
if ( cal->isStandard )
mCalendar->setDefaultCalendar( cal->mCalNumber );
cal = calendars.next();
}
mCalendar->setSyncEventsReadOnly();
mCalendar->reInitAlarmSettings();
}
void KOListView::populateCalPopup()
{
mCalPopup->clear();
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
- int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber);
+ int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber);
if ( kkf->mErrorOnLoad || kkf->isReadOnly )
mCalPopup->setItemEnabled( index, false );
kkf = KOPrefs::instance()->mCalendars.next();
}
}
void KOListView::updateList()
{
// qDebug(" KOListView::updateList() ");
}
void KOListView::clearList()
{
clear ();
}
-void KOListView::addCat( )
-{
- setCategories( false );
-}
+
void KOListView::setCat()
{
- setCategories( true );
+
+ bool set = true;
+ int result = KMessageBox::warningYesNoCancel(this,
+ i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"),
+ i18n("Set categories"),
+ i18n("Add"),
+ i18n("Reset"));
+ if (result == KMessageBox::Cancel) return;
+ if (result == KMessageBox::Yes) set = false;
+ setCategories( set );
}
void KOListView::setAlarm()
{
KOAlarmPrefs kap( this);
if ( !kap.exec() )
return;
- QStringList itemList;
QPtrList<KOListViewItem> sel ;
QListViewItem *qitem = mListView->firstChild ();
while ( qitem ) {
if ( qitem->isSelected() ) {
Incidence* inc = ((KOListViewItem *) qitem)->data();
if ( inc->typeID() != journalID ) {
if ( inc->typeID() == todoID ) {
if ( ((Todo*)inc)->hasDueDate() )
sel.append(((KOListViewItem *)qitem));
} else
sel.append(((KOListViewItem *)qitem));
}
}
qitem = qitem->nextSibling();
}
int count = 0;
@@ -530,117 +532,55 @@ void KOListView::setAlarm()
topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
qDebug("KO: Set alarm for %d items", count);
calendar()->reInitAlarmSettings();
QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
}
void KOListView::setCategories( bool removeOld )
{
KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
csd->setColorEnabled();
if (! csd->exec()) {
delete csd;
return;
}
QStringList catList = csd->selectedCategories();
delete csd;
- // if ( catList.count() == 0 )
- // return;
- //catList.sort();
- QString categoriesStr = catList.join(",");
- int i;
- QStringList itemList;
- QPtrList<KOListViewItem> sel ;
- QListViewItem *qitem = mListView->firstChild ();
- while ( qitem ) {
- if ( qitem->isSelected() ) {
- sel.append(((KOListViewItem *)qitem));
- }
- qitem = qitem->nextSibling();
- }
- KOListViewItem * item, *temp;
- item = sel.first();
- if( item ) {
- Incidence* inc = item->data() ;
- bool setSub = false;
- if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) {
- int result = KMessageBox::warningYesNoCancel(this,
- i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
- i18n("Todo has subtodos"),
- i18n("Yes"),
- i18n("No"));
- if (result == KMessageBox::Cancel) item = 0;
- if (result == KMessageBox::Yes) setSub = true;
- }
- while ( item ) {
- inc = item->data();
- if ( removeOld ) {
- inc->setCategories( catList, setSub );
- } else {
- inc->addCategories( catList, setSub );
- }
+ QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
+ Incidence* inc = delSel.first();
+ while ( inc ) {
+ if ( removeOld ) {
+ inc->setCategories( catList, false );
+ } else {
+ inc->addCategories( catList, false );
+ }
+ KOListViewItem* item = getItemForEvent(inc);
+ if (item) {
ListItemVisitor v(item, mStartDate );
inc->accept(v);
- item = sel.next();
}
+ inc = delSel.next();
}
QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
}
void KOListView::beamSelected()
{
QPtrList<Incidence> delSel = getSelectedIncidences() ;
- int icount = delSel.count();
- if ( icount ) {
+ if ( delSel.count() )
emit beamIncidenceList( delSel );
- return;
- QString fn ;
- fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
- QString mes;
- bool createbup = true;
- if ( createbup ) {
- QString description = "\n";
- CalendarLocal* cal = new CalendarLocal();
- cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
- Incidence *incidence = delSel.first();
- while ( incidence ) {
- Incidence *in = incidence->clone();
- description += in->summary() + "\n";
- cal->addIncidence( in );
- incidence = delSel.next();
- }
- FileStorage storage( cal, fn, new VCalFormat );
- storage.save();
- delete cal;
- mes = i18n("KO/Pi: Ready for beaming");
- topLevelWidget()->setCaption(mes);
-
-#ifndef DESKTOP_VERSION
- Ir *ir = new Ir( this );
- connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
- ir->send( fn, description, "text/x-vCalendar" );
-#endif
- }
- }
-}
-void KOListView::beamDone( Ir *ir )
-{
-#ifndef DESKTOP_VERSION
- delete ir;
-#endif
- topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
}
void KOListView::saveDescriptionToFile()
{
int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
i18n("Continue"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
return;
}
QPtrList<Incidence> delSel = getSelectedIncidences() ;
int icount = delSel.count();
if ( icount ) {
QString fn = KOPrefs::instance()->mLastSaveFile;
@@ -1093,35 +1033,34 @@ void KOListView::showEvents(QPtrList<Event> eventList)
int KOListView::count()
{
return mListView->childCount();
}
void KOListView::changeEventDisplay(Event *event, int action)
{
KOListViewItem *item;
switch(action) {
case KOGlobals::EVENTADDED:
addIncidence( event );
break;
case KOGlobals::EVENTEDITED:
item = getItemForEvent(event);
if (item) {
- mUidDict.remove( event->uid() );
- delete item;
- addIncidence( event );
+ ListItemVisitor v(item, mStartDate );
+ ((Incidence*)event)->accept(v);
}
break;
case KOGlobals::EVENTDELETED:
item = getItemForEvent(event);
if (item) {
mUidDict.remove( event->uid() );
delete item;
}
break;
default:
;
}
}
KOListViewItem *KOListView::getItemForEvent(Incidence *event)
{
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index bcef0f0..a54b550 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -17,37 +17,32 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOLISTVIEW_H
#define _KOLISTVIEW_H
#include <qlistview.h>
#include <qmap.h>
#include <qdict.h>
#include <klistview.h>
-#ifndef DESKTOP_VERSION
-#include <qtopia/ir.h>
-#else
-#define Ir char
-#endif
#include <libkcal/incidence.h>
#include "koeventview.h"
#include "customlistviewitem.h"
using namespace KCal;
class KOListViewWhatsThis;
#include <qpushbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qtimer.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qtooltip.h>
@@ -266,42 +261,40 @@ class KOListView : public KOEventView
void showCompletedTodos();
signals:
void signalNewEvent();
void beamIncidenceList(QPtrList<Incidence>);
public slots:
void hideAll();
void printList();
void resetFocus();
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 saveToFileVCS();
void saveDescriptionToFile();
void beamSelected();
void updateConfig();
- void addCat();
void setCat();
void setAlarm();
void setCategories( bool removeOld );
void changeEventDisplay(Event *, int);
void defaultItemAction(QListViewItem *item);
void popupMenu(QListViewItem *item,const QPoint &,int);
void setCalendar( int c );
void populateCalPopup();
protected slots:
void processSelectionChange(QListViewItem *);
protected:
void writeToFile( bool iCal );
void addEvents(QPtrList<Event> eventList);
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 02d7aae..6337ca5 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -216,33 +216,33 @@ KOPrefs::KOPrefs() :
addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
addItemBool("MonthViewWeek",&mMonthViewWeek,false);
addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
addItemBool("UseAppColors",&mUseAppColors,false);
KPrefs::setCurrentGroup("Views");
- addItemBool("Block Popup Menu",&mBlockPopupMenu,true);
+ addItemBool("Block Popup Menu",&mBlockPopupMenu,false);
addItemBool("Show Date Navigator",&mShowDateNavigator,true);
addItemInt("Hour Size",&mHourSize,8);
addItemBool("Show Daily Recurrences",&mDailyRecur,true);
addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
addItemBool("ShowShortMonthName",&mMonthShowShort,false);
addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
#ifdef DESKTOP_VERION
addItemBool("Enable ToolTips",&mEnableToolTips,true);
#else
addItemBool("Enable ToolTips",&mEnableToolTips,false);
#endif
addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index bd191d8..792a7b8 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -442,32 +442,34 @@ void KOViewManager::showListView()
mMainView, SLOT(editIncidence(Incidence *)));
connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
connect( mListView, SIGNAL( signalNewEvent() ),
mMainView, SLOT( newEvent() ) );
connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( moveIncidence( Incidence * ) ) );
connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( beamIncidence( Incidence * ) ) );
+ connect( mListView, SIGNAL( beamIncidenceList( QPtrList<Incidence> ) ),
+ mMainView, SLOT ( beamIncidenceList( QPtrList<Incidence> ) ) );
}
// bool temp = mFlagShowNextxDays;
//globalFlagBlockPainting = true;
globalFlagBlockAgenda = 1;
if ( KOPrefs::instance()->mListViewMonthTimespan ) {
mMainView->setBlockShowDates( true );
mMainView->dateNavigator()->selectMonth();
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 );
}