Ejemplo n.º 1
0
bool KCalSharedResource::get_todo_changes(OSyncDataSource *dsobj, OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx)
{
	OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info);
	OSyncObjFormat *objformat = osync_format_env_find_objformat(formatenv, "vtodo20");

	KCal::Todo::List todos = calendar->todos();

	for (KCal::Todo::List::ConstIterator i = todos.begin(); i != todos.end(); i++) {
		if ( ! dsobj->has_category((*i)->categories()) )
			continue;

		if (!report_incidence(dsobj, sink, info, ctx, *i, objformat))
			return false;
	}

	return true;
}
Ejemplo n.º 2
0
int main(int argc,char **argv)
{
  KAboutData aboutData("testcalendar", 0,ki18n("Test Calendar"),"0.1");
  KCmdLineArgs::init(argc,argv,&aboutData);

  KCmdLineOptions options;
  options.add("verbose", ki18n("Verbose output"));
  KCmdLineArgs::addCmdLineOptions( options );

  KComponentData componentData( &aboutData );
  //QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  Q_UNUSED( args );

  CalendarLocal cal( KDateTime::UTC );

  cal.load("cal");

  KCal::Todo::List todoList;
  KCal::Todo::List::ConstIterator todo;

  // Build dictionary to look up Task object from Todo uid.  Each task is a
  // QListViewItem, and is initially added with the view as the parent.
  todoList = cal.rawTodos();
  kDebug() << (*todoList.begin())->uid();
  QString result=(*todoList.begin())->customProperty(QByteArray("karm"),QByteArray("totalTaskTime"));
  kDebug() << result;
  if (result != QString("a,b"))
  {
    kDebug() << "The string a,b was expected, but given was" << result;
    return 1;
  }
  else
  {
    kDebug() << "Test passed";
  }
}