2
This file is part of KNewStuff2.
3
Copyright (c) 2007 Josef Spillner <spillner@kde.org>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library. If not, see <http://www.gnu.org/licenses/>.
19
#include "knewstuff2_cache.h"
21
#include <knewstuff2/core/entryhandler.h>
22
#include <knewstuff2/core/coreengine.h>
24
#include <kstandarddirs.h>
25
#include <qapplication.h>
28
#include <QtCore/QFile>
30
#include <unistd.h> // for exit()
32
KNewStuff2Cache::KNewStuff2Cache()
38
void KNewStuff2Cache::run()
40
// qDebug() << "-- start the engine";
42
m_engine = new KNS::CoreEngine(0);
43
m_engine->setCachePolicy(KNS::CoreEngine::CacheOnly);
44
bool ret = m_engine->init("knewstuff2_test.knsrc");
46
// qDebug() << "-- engine initialisation result: " << ret;
50
SIGNAL(signalEntryLoaded(KNS::Entry*,const KNS::Feed*,const KNS::Provider*)),
51
SLOT(slotEntryLoaded(KNS::Entry*,const KNS::Feed*,const KNS::Provider*)));
53
SIGNAL(signalEntriesFailed()),
54
SLOT(slotEntriesFailed()));
56
SIGNAL(signalEntriesFinished()),
57
SLOT(slotEntriesFinished()));
61
qWarning() << "ACHTUNG: you probably need to 'make install' the knsrc file first.";
62
qWarning() << "Although this is not required anymore, so something went really wrong.";
67
void KNewStuff2Cache::slotEntryLoaded(KNS::Entry *entry, const KNS::Feed *feed, const KNS::Provider *provider)
72
// qDebug() << "SLOT: slotEntryLoaded";
73
// qDebug() << "-- entry: " << entry->name().representation();
76
void KNewStuff2Cache::slotEntriesFailed()
78
// qDebug() << "SLOT: slotEntriesFailed";
82
void KNewStuff2Cache::slotEntriesFinished()
84
// qDebug() << "SLOT: slotEntriesFinished";
88
void KNewStuff2Cache::quitTest()
90
// qDebug() << "-- quitting now...";
92
// this would be the soft way out...
101
int main(int argc, char **argv)
103
QApplication::setApplicationName("knewstuff2_cache");
104
QApplication app(argc, argv);
106
// Take source directory into account
107
// qDebug() << "-- adding source directory " << KNSSRCDIR;
108
// qDebug() << "-- adding build directory " << KNSBUILDDIR;
109
KGlobal::dirs()->addResourceDir("config", KNSSRCDIR);
110
KGlobal::dirs()->addResourceDir("config", KNSBUILDDIR);
112
KNewStuff2Cache *test = new KNewStuff2Cache();