void ConfirmSaveDialog::addIncidences( const Incidence::List &incidences, const QString &operation ) { Incidence::List::ConstIterator it; for( it = incidences.begin(); it != incidences.end(); ++it ) { Incidence *i = *it; KListViewItem *item = new KListViewItem( mListView ); item->setText( 0, operation ); item->setText( 1, i->type() ); item->setText( 2, i->summary() ); item->setText( 3, i->uid() ); } }
bool KOMailClient::mailTo( IncidenceBase *incidence, const Identity &identity, const QString &from, bool bccMe, const QString &recipients, const QString &attachment, bool useSendmail ) { QString subject; if ( incidence->type() != "FreeBusy" ) { Incidence *inc = static_cast<Incidence *>( incidence ); subject = inc->summary(); } else { subject = "Free Busy Message"; } QString body = IncidenceFormatter::mailBodyStr( incidence, KSystemTimeZones::local() ); return send( identity, from, recipients, QString(), subject, body, false, bccMe, attachment, useSendmail ); }
QMimeData *DndFactory::createMimeData( Incidence *incidence ) { CalendarLocal cal( d->mCalendar->timeSpec() ); Incidence *i = incidence->clone(); cal.addIncidence( i ); QMimeData *mimeData = new QMimeData; ICalDrag::populateMimeData( mimeData, &cal ); VCalDrag::populateMimeData( mimeData, &cal ); KUrl uri = i->uri(); if ( uri.isValid() ) { QMap<QString, QString> metadata; metadata["labels"] = KUrl::toPercentEncoding( i->summary() ); uri.populateMimeData( mimeData, metadata ); } return mimeData; }
bool KOMailClient::mailOrganizer( IncidenceBase *incidence, const Identity &identity, const QString &from, bool bccMe, const QString &attachment, const QString &sub, bool useSendmail ) { QString to = incidence->organizer().fullName(); QString subject = sub; if ( incidence->type() != "FreeBusy" ) { Incidence *inc = static_cast<Incidence *>( incidence ); if ( subject.isEmpty() ) { subject = inc->summary(); } } else { subject = "Free Busy Message"; } QString body = IncidenceFormatter::mailBodyStr( incidence, KSystemTimeZones::local() ); return send( identity, from, to, QString(), subject, body, false, bccMe, attachment, useSendmail ); }
void SearchDialog::search(const QRegExp &re) { QDate startDt = mStartDate->date(); QDate endDt = mEndDate->date(); Event::List events; if(mEventsCheck->isChecked()) { events = mCalendar->events(startDt, endDt, mInclusiveCheck->isChecked()); } Todo::List todos; if(mTodosCheck->isChecked()) { if(mIncludeUndatedTodos->isChecked()) { Todo::List alltodos = mCalendar->todos(); Todo::List::iterator it; Todo *todo; for(it = alltodos.begin(); it != alltodos.end(); ++it) { todo = *it; if((!todo->hasStartDate() && !todo->hasDueDate()) || // undated (todo->hasStartDate() && (todo->dtStart() >= startDt) && (todo->dtStart() <= endDt)) || // start dt in range (todo->hasDueDate() && (todo->dtDue().date() >= startDt) && (todo->dtDue() <= endDt)) || // due dt in range (todo->hasCompletedDate() && (todo->completed().date() >= startDt) && (todo->completed() <= endDt))) // completed dt in range { todos.append(todo); } } } else { QDate dt = startDt; while(dt <= endDt) { todos += mCalendar->todos(dt); dt = dt.addDays(1); } } } Journal::List journals; if(mJournalsCheck->isChecked()) { QDate dt = startDt; while(dt <= endDt) { journals += mCalendar->journals(dt); dt = dt.addDays(1); } } Incidence::List allIncidences = Calendar::mergeIncidenceList(events, todos, journals); mMatchedEvents.clear(); Incidence::List::ConstIterator it; for(it = allIncidences.begin(); it != allIncidences.end(); ++it) { Incidence *ev = *it; if(mSummaryCheck->isChecked()) { #if QT_VERSION >= 300 if(re.search(ev->summary()) != -1) { #else if(re.match(ev->summary()) != -1) { #endif mMatchedEvents.append(ev); continue; } } if(mDescriptionCheck->isChecked()) { #if QT_VERSION >= 300 if(re.search(ev->description()) != -1) { #else if(re.match(ev->description()) != -1) { #endif mMatchedEvents.append(ev); continue; } } if(mCategoryCheck->isChecked()) { #if QT_VERSION >= 300 if(re.search(ev->categoriesStr()) != -1) { #else if(re.match(ev->categoriesStr()) != -1) { #endif mMatchedEvents.append(ev); continue; } } } }
bool KOMailClient::mailAttendees( IncidenceBase *incidence, const Identity &identity, bool bccMe, const QString &attachment, bool useSendmail ) { Attendee::List attendees = incidence->attendees(); if ( attendees.count() == 0 ) { return false; } const QString from = incidence->organizer().fullName(); const QString organizerEmail = incidence->organizer().email(); QStringList toList; QStringList ccList; for ( int i=0; i<attendees.count(); ++i ) { Attendee *a = attendees.at(i); const QString email = a->email(); if ( email.isEmpty() ) { continue; } // In case we (as one of our identities) are the organizer we are sending // this mail. We could also have added ourselves as an attendee, in which // case we don't want to send ourselves a notification mail. if ( organizerEmail == email ) { continue; } // Build a nice address for this attendee including the CN. QString tname, temail; const QString username = KPIMUtils::quoteNameIfNecessary( a->name() ); // ignore the return value from extractEmailAddressAndName() because // it will always be false since tusername does not contain "@domain". KPIMUtils::extractEmailAddressAndName( username, temail, tname ); tname += " <" + email + '>'; // Optional Participants and Non-Participants are copied on the email if ( a->role() == Attendee::OptParticipant || a->role() == Attendee::NonParticipant ) { ccList << tname; } else { toList << tname; } } if( toList.count() == 0 && ccList.count() == 0 ) { // Not really to be called a groupware meeting, eh return false; } QString to; if ( toList.count() > 0 ) { to = toList.join( ", " ); } QString cc; if ( ccList.count() > 0 ) { cc = ccList.join( ", " ); } QString subject; if ( incidence->type() != "FreeBusy" ) { Incidence *inc = static_cast<Incidence *>( incidence ); subject = inc->summary(); } else { subject = "Free Busy Object"; } QString body = IncidenceFormatter::mailBodyStr( incidence, KSystemTimeZones::local() ); return send( identity, from, to, cc, subject, body, false, bccMe, attachment, useSendmail ); }
int main(int argc, char **argv) { KAboutData aboutData("testrecurrencenew", "Load recurrence rules with the new class and print out debug messages", "0.1"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KApplication app(false, false); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if(args->count() < 1) { args->usage("Wrong number of arguments."); } // use zoneinfo data from source dir set_zone_directory(KDETOPSRCDIR "/libkcal/libical/zoneinfo"); QString input = QFile::decodeName(args->arg(0)); kdDebug(5800) << "Input file: " << input << endl; QTextStream *outstream; outstream = 0; QString fn(""); if(args->count() > 1) { fn = args->arg(1); kdDebug() << "We have a file name given: " << fn << endl; } QFile outfile(fn); if(!fn.isEmpty() && outfile.open(IO_WriteOnly)) { kdDebug() << "Opened output file!!!" << endl; outstream = new QTextStream(&outfile); } CalendarLocal cal(QString::fromLatin1("UTC")); if(!cal.load(input)) return 1; QString tz = cal.nonKDECustomProperty("X-LibKCal-Testsuite-OutTZ"); if(!tz.isEmpty()) { cal.setTimeZoneIdViewOnly(tz); } Incidence::List inc = cal.incidences(); for(Incidence::List::Iterator it = inc.begin(); it != inc.end(); ++it) { Incidence *incidence = *it; kdDebug(5800) << "*+*+*+*+*+*+*+*+*+*" << endl; kdDebug(5800) << " -> " << incidence->summary() << " <- " << endl; incidence->recurrence()->dump(); QDateTime dt(incidence->recurrence()->endDateTime()); int i = 0; if(outstream) { if(!dt.isValid()) dt = QDateTime(QDate(2011, 1, 1), QTime(0, 0, 1)); else dt = dt.addYears(2); kdDebug(5800) << "-------------------------------------------" << endl; kdDebug(5800) << " *~*~*~*~ Starting with date: " << dt << endl; // Output to file for testing purposes while(dt.isValid() && i < 500) { dt = dt.addSecs(-1); ++i; dt = incidence->recurrence()->getPreviousDateTime(dt); (*outstream) << dt.toString(Qt::ISODate) << endl; } } else { if(!dt.isValid()) dt = QDateTime(QDate(2005, 7, 31), QTime(23, 59, 59)); else dt = dt.addYears(2); incidence->recurrence()->dump(); kdDebug(5800) << "-------------------------------------------" << endl; kdDebug(5800) << " *~*~*~*~ Starting with date: " << dt << endl; // Output to konsole while(dt.isValid() && i < 50) { dt = dt.addSecs(-1); ++i; kdDebug(5800) << "-------------------------------------------" << endl; dt = incidence->recurrence()->getPreviousDateTime(dt); kdDebug(5800) << " *~*~*~*~ Previous date is: " << dt << endl; } } } delete outstream; outfile.close(); return 0; }