[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/office/tellico/src
From: Robby Stephenson <robby () periapsis ! org>
Date: 2009-07-01 1:58:03
Message-ID: 1246413483.576281.8925.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 989794 by rstephenson:
add alexandria importer test
M +4 -0 tests/CMakeLists.txt
A tests/alexandriaimporttest.cpp [License: GPL (v2/3)]
A tests/alexandriaimporttest.h [License: GPL (v2/3)]
A tests/data/alexandria (directory)
A tests/data/alexandria/0060574623.yaml
A tests/data/alexandria/0060608536.yaml
AM tests/data/alexandria/0060608536_small.jpg
M +1 -1 tests/fieldtest.cpp
M +1 -1 tests/fieldtest.h
M +21 -11 translators/alexandriaimporter.cpp
M +4 -1 translators/alexandriaimporter.h
--- trunk/extragear/office/tellico/src/tests/CMakeLists.txt #989793:989794
@@ -55,6 +55,10 @@
KDE4_ADD_UNIT_TEST(collectiontest NOGUI collectiontest.cpp ${collection_SRCS})
TARGET_LINK_LIBRARIES(collectiontest core utils ${QT_AND_KDECORE_LIBS} \
${KDE4_KDEUI_LIBS} ${QT_QTTEST_LIBRARY} )
+KDE4_ADD_UNIT_TEST(alexandriaimporttest NOGUI alexandriaimporttest.cpp \
../translators/alexandriaimporter.cpp + ../core/filehandler.cpp \
${collection_SRCS}) +TARGET_LINK_LIBRARIES(alexandriaimporttest ${IMPORTER_LIBS} )
+
KDE4_ADD_UNIT_TEST(amcimporttest NOGUI amcimporttest.cpp \
../translators/amcimporter.cpp ${collection_SRCS}) \
TARGET_LINK_LIBRARIES(amcimporttest ${IMPORTER_LIBS} )
** trunk/extragear/office/tellico/src/tests/data/alexandria/0060608536_small.jpg \
#property svn:mime-type + application/octet-stream
--- trunk/extragear/office/tellico/src/tests/fieldtest.cpp #989793:989794
@@ -32,7 +32,7 @@
QTEST_KDEMAIN_CORE( FieldTest )
-void FieldTest::testEmpty() {
+void FieldTest::testAll() {
Tellico::Data::Field field1("name", "title");
// the default field type is line
--- trunk/extragear/office/tellico/src/tests/fieldtest.h #989793:989794
@@ -31,7 +31,7 @@
Q_OBJECT
private Q_SLOTS:
- void testEmpty();
+ void testAll();
};
#endif
--- trunk/extragear/office/tellico/src/translators/alexandriaimporter.cpp \
#989793:989794 @@ -27,7 +27,6 @@
#include "../entry.h"
#include "../field.h"
#include "../images/imagefactory.h"
-#include "../progressmanager.h"
#include "../tellico_debug.h"
#include "../utils/isbnvalidator.h"
@@ -48,16 +47,26 @@
}
Tellico::Data::CollPtr AlexandriaImporter::collection() {
- if(!m_widget || m_library->count() == 0) {
+ QDir dataDir;
+ if(m_libraryDir.exists() && m_library && m_library->count() > 0) {
+ dataDir = m_libraryDir;
+ dataDir.cd(m_library->currentText());
+ } else if(!m_libraryPath.isEmpty()) {
+ dataDir.setPath(m_libraryPath);
+ } else {
+ // no widget and no explicit set of the library path means we fail
+ myWarning() << "no widget and no library path";
return Data::CollPtr();
}
+ // just a sanity check
+ if(!dataDir.exists()) {
+ myDebug() << dataDir.path() << "doesn't exist";
+ return Data::CollPtr();
+ }
+ dataDir.setFilter(QDir::Files | QDir::Readable | QDir::NoSymLinks);
m_coll = new Data::BookCollection(true);
- QDir dataDir = m_libraryDir;
- dataDir.cd(m_library->currentText());
- dataDir.setFilter(QDir::Files | QDir::Readable | QDir::NoSymLinks);
-
const QString title = QLatin1String("title");
const QString author = QLatin1String("author");
const QString year = QLatin1String("pub_year");
@@ -75,10 +84,7 @@
const uint stepSize = qMax(s_stepSize, numFiles/100);
const bool showProgress = options() & ImportProgress;
- ProgressItem& item = ProgressManager::self()->newProgressItem(this, \
progressLabel(), true);
- item.setTotalSteps(numFiles);
- connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel()));
- ProgressItem::Done done(this);
+ emit signalTotalSteps(this, numFiles);
QStringList covers;
covers << QLatin1String(".cover")
@@ -183,7 +189,7 @@
m_coll->addEntries(entry);
if(showProgress && j%stepSize == 0) {
- ProgressManager::self()->setProgress(this, j);
+ emit signalProgress(this, j);
kapp->processEvents();
}
}
@@ -219,6 +225,10 @@
l->addWidget(gbox);
l->addStretch(1);
+
+ // now that we set a widget, it should override library path
+ m_libraryPath.clear();
+
return m_widget;
}
--- trunk/extragear/office/tellico/src/translators/alexandriaimporter.h \
#989793:989794 @@ -50,7 +50,7 @@
public:
/**
*/
- AlexandriaImporter() : Importer(), m_widget(0), m_cancelled(false) {}
+ AlexandriaImporter() : Importer(), m_widget(0), m_library(0), m_cancelled(false) \
{} /**
*/
virtual ~AlexandriaImporter() {}
@@ -63,6 +63,8 @@
virtual QWidget* widget(QWidget* parent);
virtual bool canImport(int type) const;
+ void setLibraryPath(const QString& libraryPath) { m_libraryPath = libraryPath; }
+
public slots:
void slotCancel();
@@ -73,6 +75,7 @@
Data::CollPtr m_coll;
QWidget* m_widget;
KComboBox* m_library;
+ QString m_libraryPath;
QDir m_libraryDir;
bool m_cancelled : 1;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic