diff --git a/akonadi/tests/testrunner/akonaditesting.cpp b/akonadi/tests/testrunner/akonaditesting.cpp index 6777bb4b4..3edbc5a91 100644 --- a/akonadi/tests/testrunner/akonaditesting.cpp +++ b/akonadi/tests/testrunner/akonaditesting.cpp @@ -1,69 +1,71 @@ /* * Copyright (c) 2008 Igor Trindade Oliveira * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "akonaditesting.h" #include "dao.h" #include "item.h" #include "itemfactory.h" #include "config.h" #include #include #include #include +#include + AkonadiTesting::AkonadiTesting( const QString &configFileName ) { Q_UNUSED( configFileName ) // TODO use this if !isNull() } AkonadiTesting::AkonadiTesting() { } AkonadiTesting::~AkonadiTesting() { } void AkonadiTesting::insertItem( const QString &fileName, const QString &collectionName ) { ItemFactory factory; DAO dao; const Akonadi::Collection collection = dao.collectionByName( collectionName ); - const Item *item = factory.createItem( fileName ); + std::auto_ptr item(factory.createItem( fileName )); foreach ( const Akonadi::Item &akonadItem, item->items() ) { if ( dao.insertItem( akonadItem, collection ) ) { qDebug()<<"Item loaded to Akonadi"; } else { qDebug()<<"Item can not be loaded"; } } } void AkonadiTesting::insertItemFromList() { const Config *config = Config::instance(); QPair configItem; foreach (configItem, config->itemConfig() ) { insertItem( configItem.first, configItem.second ); } } diff --git a/akonadi/tests/testrunner/item.h b/akonadi/tests/testrunner/item.h index 4f1cb8d36..c1e86a6af 100644 --- a/akonadi/tests/testrunner/item.h +++ b/akonadi/tests/testrunner/item.h @@ -1,38 +1,38 @@ /* * Copyright (c) 2008 Igor Trindade Oliveira * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef ITEM_H #define ITEM_H #include #include #include class Item { public: Item( const QString &mimetype ); Akonadi::Item::List items() const; - + virtual ~Item() {}; protected: Akonadi::Item::List mItems; QString mMimeType; Akonadi::Collection mCollection; }; #endif