forked from baumgarr/nixnote2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to import notes via the command line.
- Loading branch information
Showing
9 changed files
with
150 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "importnotes.h" | ||
#include <iostream> | ||
#include <QFile> | ||
#include "xml/importdata.h" | ||
|
||
ImportNotes::ImportNotes(QObject *parent) : | ||
QObject(parent) | ||
{ | ||
inputFile = ""; | ||
} | ||
|
||
|
||
|
||
|
||
// Perform the import via the command line | ||
int ImportNotes::import() { | ||
|
||
if (inputFile.trimmed() == "") { | ||
std::cout << QString(tr("Input file not specified.")).toStdString() << std::endl; | ||
return 16; | ||
} | ||
QFile f(inputFile); | ||
if (!f.exists()) { | ||
std::cout << QString(tr("Input file not found.")).toStdString() << std::endl; | ||
return 16; | ||
} | ||
|
||
ImportData importData(false,true,0); | ||
importData.import(inputFile); | ||
if (importData.lastError != 0) { | ||
std::cout << importData.errorMessage.toStdString() << std::endl; | ||
return 16; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef IMPORTNOTES_H | ||
#define IMPORTNOTES_H | ||
|
||
#include <QObject> | ||
|
||
class ImportNotes : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ImportNotes(QObject *parent = 0); | ||
QString inputFile; | ||
int import(); | ||
|
||
signals: | ||
|
||
public slots: | ||
|
||
}; | ||
|
||
#endif // IMPORTNOTES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters