]> pilppa.com Git - vcard-tracker-import.git/commitdiff
initial commit master v0.1
authorMika Laitio <lamikr@pilppa.org>
Tue, 26 Jul 2011 09:35:14 +0000 (12:35 +0300)
committerMika Laitio <lamikr@pilppa.org>
Tue, 26 Jul 2011 09:35:14 +0000 (12:35 +0300)
Makefile [new file with mode: 0644]
README [new file with mode: 0644]
src/Makefile [new file with mode: 0644]
src/VCardDirectoryImporter.cpp [new file with mode: 0644]
src/VCardDirectoryImporter.h [new file with mode: 0644]
src/main.cpp [new file with mode: 0644]
src/src.pro [new file with mode: 0644]
vcard-tracker-import.pro [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..2632090
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,132 @@
+#############################################################################
+# Makefile for building: vcard-tracker-import
+# Generated by qmake (2.01a) (Qt 4.7.2) on: ti heinäkuuta 26 09:33:52 2011
+# Project:  vcard-tracker-import.pro
+# Template: subdirs
+# Command: /usr/bin/qmake -o Makefile vcard-tracker-import.pro
+#############################################################################
+
+first: make_default
+MAKEFILE      = Makefile
+QMAKE         = /usr/bin/qmake
+DEL_FILE      = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+COPY          = cp -f
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+INSTALL_FILE  = install -m 644 -p
+INSTALL_PROGRAM = install -m 755 -p
+INSTALL_DIR   = $(COPY_DIR)
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+SUBTARGETS    =  \
+               sub-src
+
+src/$(MAKEFILE): 
+       @$(CHK_DIR_EXISTS) src/ || $(MKDIR) src/ 
+       cd src/ && $(QMAKE) /apps/vcard-tracker-import-0.1/src/src.pro -o $(MAKEFILE)
+sub-src-qmake_all:  FORCE
+       @$(CHK_DIR_EXISTS) src/ || $(MKDIR) src/ 
+       cd src/ && $(QMAKE) /apps/vcard-tracker-import-0.1/src/src.pro -o $(MAKEFILE)
+sub-src: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE)
+sub-src-make_default-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) 
+sub-src-make_default: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) 
+sub-src-make_first-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) first
+sub-src-make_first: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) first
+sub-src-all-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) all
+sub-src-all: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) all
+sub-src-clean-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) clean
+sub-src-clean: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) clean
+sub-src-distclean-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) distclean
+sub-src-distclean: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) distclean
+sub-src-install_subtargets-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) install
+sub-src-install_subtargets: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) install
+sub-src-uninstall_subtargets-ordered: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) uninstall
+sub-src-uninstall_subtargets: src/$(MAKEFILE) FORCE
+       cd src/ && $(MAKE) -f $(MAKEFILE) uninstall
+
+Makefile: vcard-tracker-import.pro  /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
+               /usr/share/qt4/mkspecs/common/unix.conf \
+               /usr/share/qt4/mkspecs/common/linux.conf \
+               /usr/share/qt4/mkspecs/qconfig.pri \
+               /usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /usr/share/qt4/mkspecs/features/qt_config.prf \
+               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /usr/share/qt4/mkspecs/features/default_pre.prf \
+               /usr/share/qt4/mkspecs/features/release.prf \
+               /usr/share/qt4/mkspecs/features/default_post.prf \
+               /usr/share/qt4/mkspecs/features/warn_on.prf \
+               /usr/share/qt4/mkspecs/features/qt.prf \
+               /usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /usr/share/qt4/mkspecs/features/moc.prf \
+               /usr/share/qt4/mkspecs/features/resources.prf \
+               /usr/share/qt4/mkspecs/features/uic.prf \
+               /usr/share/qt4/mkspecs/features/yacc.prf \
+               /usr/share/qt4/mkspecs/features/lex.prf \
+               /usr/share/qt4/mkspecs/features/include_source_dir.prf
+       $(QMAKE) -o Makefile vcard-tracker-import.pro
+/usr/share/qt4/mkspecs/common/g++.conf:
+/usr/share/qt4/mkspecs/common/unix.conf:
+/usr/share/qt4/mkspecs/common/linux.conf:
+/usr/share/qt4/mkspecs/qconfig.pri:
+/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/usr/share/qt4/mkspecs/features/qt_config.prf:
+/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/share/qt4/mkspecs/features/default_pre.prf:
+/usr/share/qt4/mkspecs/features/release.prf:
+/usr/share/qt4/mkspecs/features/default_post.prf:
+/usr/share/qt4/mkspecs/features/warn_on.prf:
+/usr/share/qt4/mkspecs/features/qt.prf:
+/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/usr/share/qt4/mkspecs/features/moc.prf:
+/usr/share/qt4/mkspecs/features/resources.prf:
+/usr/share/qt4/mkspecs/features/uic.prf:
+/usr/share/qt4/mkspecs/features/yacc.prf:
+/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+qmake: qmake_all FORCE
+       @$(QMAKE) -o Makefile vcard-tracker-import.pro
+
+qmake_all: sub-src-qmake_all FORCE
+
+make_default: sub-src-make_default-ordered FORCE
+make_first: sub-src-make_first-ordered FORCE
+all: sub-src-all-ordered FORCE
+clean: sub-src-clean-ordered FORCE
+distclean: sub-src-distclean-ordered FORCE
+       -$(DEL_FILE) Makefile
+install_subtargets: sub-src-install_subtargets-ordered FORCE
+uninstall_subtargets: sub-src-uninstall_subtargets-ordered FORCE
+
+sub-src-check_ordered: src/$(MAKEFILE)
+       cd src/ && $(MAKE) check
+check: sub-src-check_ordered
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+install: install_subtargets  FORCE
+
+uninstall:  uninstall_subtargets FORCE
+
+FORCE:
+
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..d78e628
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+This vcard-tracker-import application will read v-cards from the given directory
+and then save them in the tracker/libseaside format.
+
+Application is based on to qtcontacts-vcard-import-0.1 made originally
+by Tom Swindall, which saved contacts in EDS format. 
+
+Copyright (c) 2011, Mika Laitio. <lamikr@pilppa.org>
+
+This program is licensed under the terms and conditions of the
+Apache License, version 2.0.  The full text of the Apache License is at
+http://www.apache.org/licenses/LICENSE-2.0
+
diff --git a/src/Makefile b/src/Makefile
new file mode 100644 (file)
index 0000000..24ba1a3
--- /dev/null
@@ -0,0 +1,234 @@
+#############################################################################
+# Makefile for building: vcard-tracker-import
+# Generated by qmake (2.01a) (Qt 4.7.2) on: ti heinäkuuta 26 08:29:42 2011
+# Project:  src.pro
+# Template: app
+# Command: /usr/bin/qmake -o Makefile src.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC            = gcc
+CXX           = g++
+DEFINES       = -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -DQT_SHARED -I/usr/include/meegotouch -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS      = -pipe -O2 -DQT_SHARED -I/usr/include/meegotouch -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I/usr/include/QtVersit -I/usr/include/QtContacts -I/usr/include -I/usr/include/QtMobility -I.
+LINK          = g++
+LFLAGS        = -Wl,-O1
+LIBS          = $(SUBLIBS)  -L/usr/lib -lseaside -lmeegotouchcore -lQtGui -L/usr/lib -lQtContacts -lQtVersit -lQtCore -lpthread 
+AR            = ar cqs
+RANLIB        = 
+QMAKE         = /usr/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+STRIP         = strip
+INSTALL_FILE  = install -m 644 -p
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR   = ./
+
+####### Files
+
+SOURCES       = main.cpp \
+               VCardDirectoryImporter.cpp moc_VCardDirectoryImporter.cpp
+OBJECTS       = main.o \
+               VCardDirectoryImporter.o \
+               moc_VCardDirectoryImporter.o
+DIST          = /usr/share/qt4/mkspecs/common/g++.conf \
+               /usr/share/qt4/mkspecs/common/unix.conf \
+               /usr/share/qt4/mkspecs/common/linux.conf \
+               /usr/share/qt4/mkspecs/qconfig.pri \
+               /usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /usr/share/qt4/mkspecs/features/qt_config.prf \
+               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /usr/share/qt4/mkspecs/features/default_pre.prf \
+               /usr/share/qt4/mkspecs/features/release.prf \
+               /usr/share/qt4/mkspecs/features/default_post.prf \
+               /usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
+               /usr/share/qt4/mkspecs/features/mobility.prf \
+               /usr/share/qt4/mkspecs/features/warn_on.prf \
+               /usr/share/qt4/mkspecs/features/qt.prf \
+               /usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /usr/share/qt4/mkspecs/features/moc.prf \
+               /usr/share/qt4/mkspecs/features/resources.prf \
+               /usr/share/qt4/mkspecs/features/uic.prf \
+               /usr/share/qt4/mkspecs/features/yacc.prf \
+               /usr/share/qt4/mkspecs/features/lex.prf \
+               /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               src.pro
+QMAKE_TARGET  = vcard-tracker-import
+DESTDIR       = 
+TARGET        = vcard-tracker-import
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+       $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET):  $(OBJECTS)  
+       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: src.pro  /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
+               /usr/share/qt4/mkspecs/common/unix.conf \
+               /usr/share/qt4/mkspecs/common/linux.conf \
+               /usr/share/qt4/mkspecs/qconfig.pri \
+               /usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /usr/share/qt4/mkspecs/features/qt_config.prf \
+               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /usr/share/qt4/mkspecs/features/default_pre.prf \
+               /usr/share/qt4/mkspecs/features/release.prf \
+               /usr/share/qt4/mkspecs/features/default_post.prf \
+               /usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
+               /usr/share/qt4/mkspecs/features/mobility.prf \
+               /usr/share/qt4/mkspecs/features/warn_on.prf \
+               /usr/share/qt4/mkspecs/features/qt.prf \
+               /usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /usr/share/qt4/mkspecs/features/moc.prf \
+               /usr/share/qt4/mkspecs/features/resources.prf \
+               /usr/share/qt4/mkspecs/features/uic.prf \
+               /usr/share/qt4/mkspecs/features/yacc.prf \
+               /usr/share/qt4/mkspecs/features/lex.prf \
+               /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               /usr/lib/libmeegotouchcore.prl \
+               /usr/lib/libQtGui.prl \
+               /usr/lib/libQtCore.prl \
+               /usr/lib/libQtContacts.prl \
+               /usr/lib/libQtVersit.prl
+       $(QMAKE) -o Makefile src.pro
+/usr/share/qt4/mkspecs/common/g++.conf:
+/usr/share/qt4/mkspecs/common/unix.conf:
+/usr/share/qt4/mkspecs/common/linux.conf:
+/usr/share/qt4/mkspecs/qconfig.pri:
+/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/usr/share/qt4/mkspecs/features/qt_config.prf:
+/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/share/qt4/mkspecs/features/default_pre.prf:
+/usr/share/qt4/mkspecs/features/release.prf:
+/usr/share/qt4/mkspecs/features/default_post.prf:
+/usr/share/qt4/mkspecs/features/link_pkgconfig.prf:
+/usr/share/qt4/mkspecs/features/mobility.prf:
+/usr/share/qt4/mkspecs/features/warn_on.prf:
+/usr/share/qt4/mkspecs/features/qt.prf:
+/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/usr/share/qt4/mkspecs/features/moc.prf:
+/usr/share/qt4/mkspecs/features/resources.prf:
+/usr/share/qt4/mkspecs/features/uic.prf:
+/usr/share/qt4/mkspecs/features/yacc.prf:
+/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+/usr/lib/libmeegotouchcore.prl:
+/usr/lib/libQtGui.prl:
+/usr/lib/libQtCore.prl:
+/usr/lib/libQtContacts.prl:
+/usr/lib/libQtVersit.prl:
+qmake:  FORCE
+       @$(QMAKE) -o Makefile src.pro
+
+dist: 
+       @$(CHK_DIR_EXISTS) .tmp/vcard-tracker-import1.0.0 || $(MKDIR) .tmp/vcard-tracker-import1.0.0 
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/vcard-tracker-import1.0.0/ && $(COPY_FILE) --parents VCardDirectoryImporter.h .tmp/vcard-tracker-import1.0.0/ && $(COPY_FILE) --parents main.cpp VCardDirectoryImporter.cpp .tmp/vcard-tracker-import1.0.0/ && (cd `dirname .tmp/vcard-tracker-import1.0.0` && $(TAR) vcard-tracker-import1.0.0.tar vcard-tracker-import1.0.0 && $(COMPRESS) vcard-tracker-import1.0.0.tar) && $(MOVE) `dirname .tmp/vcard-tracker-import1.0.0`/vcard-tracker-import1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/vcard-tracker-import1.0.0
+
+
+clean:compiler_clean 
+       -$(DEL_FILE) $(OBJECTS)
+       -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+       -$(DEL_FILE) $(TARGET) 
+       -$(DEL_FILE) Makefile
+
+
+check: first
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_VCardDirectoryImporter.cpp
+compiler_moc_header_clean:
+       -$(DEL_FILE) moc_VCardDirectoryImporter.cpp
+moc_VCardDirectoryImporter.cpp: VCardDirectoryImporter.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) VCardDirectoryImporter.h -o moc_VCardDirectoryImporter.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+       -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean 
+
+####### Compile
+
+main.o: main.cpp VCardDirectoryImporter.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+VCardDirectoryImporter.o: VCardDirectoryImporter.cpp VCardDirectoryImporter.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o VCardDirectoryImporter.o VCardDirectoryImporter.cpp
+
+moc_VCardDirectoryImporter.o: moc_VCardDirectoryImporter.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_VCardDirectoryImporter.o moc_VCardDirectoryImporter.cpp
+
+####### Install
+
+install_target: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/bin/ 
+       -$(INSTALL_PROGRAM) /apps/vcard-tracker-import-0.1/src/vcard-tracker-import $(INSTALL_ROOT)/usr/bin/
+
+
+uninstall_target:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/bin/vcard-tracker-import
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/bin/ 
+
+
+install:  install_target  FORCE
+
+uninstall: uninstall_target   FORCE
+
+FORCE:
+
diff --git a/src/VCardDirectoryImporter.cpp b/src/VCardDirectoryImporter.cpp
new file mode 100644 (file)
index 0000000..eace03a
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011, Mika Laitio. <lamikr@pilppa.org>, Tom Swindell
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+#include "VCardDirectoryImporter.h"
+
+#include <QDir>
+#include <QFile>
+#include <QStringList>
+#include <QCoreApplication>
+
+#include <QContactSaveRequest>
+
+#include <QVersitReader>
+#include <QVersitContactImporter>
+
+#include <seasidesyncmodel.h>
+
+QTM_USE_NAMESPACE
+
+VCardDirectoryImporter::VCardDirectoryImporter(QObject *parent) : QObject(parent) {
+
+}
+
+VCardDirectoryImporter::~VCardDirectoryImporter()
+{
+}
+
+int VCardDirectoryImporter::importVCardsDirectoryContacts(const QString &path)
+{
+    QDir                    directory(path);
+    QVersitReader           reader;
+    QVersitContactImporter  importer;
+    QList<QVersitDocument>  documents;
+    int                     ret_val;
+
+    ret_val = -1;
+    if (directory.exists() == true) {
+        qDebug() << "Importing v-card contacts from directory " << path;
+        foreach(QString fileName, directory.entryList((QStringList() << "*.vcf"), QDir::Files)) {
+            QFile file(directory.filePath(fileName));
+            file.open(QFile::ReadOnly);
+
+            reader.setDevice(&file);
+            reader.startReading();
+            reader.waitForFinished();
+
+            documents.append(reader.results());
+            qDebug() << "Read " << reader.results().count() << " contacts: " << file.fileName();
+        }
+        importer.importDocuments(documents);
+        qDebug() << "Total count of contacts read: " << importer.contacts().count();
+
+        contactList.append(importer.contacts());
+        ret_val = 0;
+    }
+    else {
+        qWarning() << "Error, V-Card contact directory" << directory.path() << "not found.";
+    }
+    return ret_val;
+}
+
+int VCardDirectoryImporter::saveContacts()
+{
+    int                 ret_val = 0;
+       SeasideSyncModel        *syncModel;
+
+       syncModel = SeasideSyncModel::instance();
+    //syncModel->addContacts(contactList, contactList.count());
+       foreach (const QContact& cnt, contactList) {
+               syncModel->updatePerson(&cnt);
+       }
+    return ret_val;
+}
diff --git a/src/VCardDirectoryImporter.h b/src/VCardDirectoryImporter.h
new file mode 100644 (file)
index 0000000..4436fb1
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011, Mika Laitio. <lamikr@pilppa.org>, Tom Swindell.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+#ifndef VCARDDIRECTORYIMPORTER_H
+#define VCARDDIRECTORYIMPORTER_H
+
+#include <QObject>
+#include <QContact>
+#include <QContactAbstractRequest>
+
+QTM_USE_NAMESPACE
+
+class VCardDirectoryImporterPrivate;
+
+class VCardDirectoryImporter : public QObject
+{
+    Q_OBJECT
+    public:
+        VCardDirectoryImporter(QObject *parent = 0);
+        ~VCardDirectoryImporter();
+        int importVCardsDirectoryContacts(const QString &path);
+        int saveContacts();
+
+    private:
+        QList<QContact> contactList;
+};
+
+#endif // VCARDDIRECTORYIMPORTER_H
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644 (file)
index 0000000..43bff99
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Mika Laitio. <lamikr@pilppa.org>
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+#include <QCoreApplication>
+#include <QDebug>
+
+#include "VCardDirectoryImporter.h"
+
+int main(int argc, char *argv[])
+{
+    int                     ret_val;
+    int                     err_flg;
+    QCoreApplication        application(argc, argv);
+    VCardDirectoryImporter  importer;
+
+    ret_val = EXIT_FAILURE;
+    if (application.arguments().count() >= 2) {
+        err_flg = importer.importVCardsDirectoryContacts(application.arguments().at(1));
+        if (err_flg == 0) {
+            importer.saveContacts();
+            ret_val = application.exec();
+        }
+    }
+    else {
+        qDebug() << "Error, directory containing v-card contact files (*.vcr) not specified.";
+        qDebug() << "Please, give the v-card directory as a first parameter for the application.";
+    }
+    return ret_val;
+}
diff --git a/src/src.pro b/src/src.pro
new file mode 100644 (file)
index 0000000..841adce
--- /dev/null
@@ -0,0 +1,21 @@
+TEMPLATE = app
+TARGET = vcard-tracker-import
+
+QT       = core
+CONFIG   -= app_bundle
+CONFIG   += console mobility link_pkgconfig
+MOBILITY = contacts versit
+PKGCONFIG += meegotouchcore
+
+SOURCES   = main.cpp \
+    VCardDirectoryImporter.cpp
+
+HEADERS += \
+    VCardDirectoryImporter.h
+
+LIBS += -lseaside
+
+target.files = vcard-tracker-import
+target.path  = /usr/bin
+
+INSTALLS += target
diff --git a/vcard-tracker-import.pro b/vcard-tracker-import.pro
new file mode 100644 (file)
index 0000000..0f0b0ec
--- /dev/null
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+CONFIG  += ordered
+SUBDIRS  = src
+