summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
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/kolistview.cpp
parentc53efbe8f53f468d21d93f5e19b625d1a4beb242 (diff)
downloadkdepimpi-541878bcf52030d8597d5e79afb6ae1185b2ac2c.zip
kdepimpi-541878bcf52030d8597d5e79afb6ae1185b2ac2c.tar.gz
kdepimpi-541878bcf52030d8597d5e79afb6ae1185b2ac2c.tar.bz2
fixixixis
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp155
1 files changed, 47 insertions, 108 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index e5e3704..4c815d8 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -290,16 +290,16 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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);
@@ -314,12 +314,18 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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,
@@ -327,23 +333,14 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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
/*
@@ -438,7 +435,7 @@ 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();
@@ -454,13 +451,19 @@ 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()
@@ -468,7 +471,6 @@ void KOListView::setAlarm()
KOAlarmPrefs kap( this);
if ( !kap.exec() )
return;
- QStringList itemList;
QPtrList<KOListViewItem> sel ;
QListViewItem *qitem = mListView->firstChild ();
while ( qitem ) {
@@ -543,45 +545,20 @@ void KOListView::setCategories( bool removeOld )
}
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() ) );
}
@@ -589,45 +566,8 @@ void KOListView::setCategories( bool removeOld )
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()
@@ -1106,9 +1046,8 @@ void KOListView::changeEventDisplay(Event *event, int action)
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: