diff --git a/src/gnc/Numeric.hpp b/src/gnc/Numeric.hpp index 7095b8655c..49e7cdd5d2 100644 --- a/src/gnc/Numeric.hpp +++ b/src/gnc/Numeric.hpp @@ -28,10 +28,12 @@ extern "C" { #include "qof.h" +#include "gnc-date.h" #include "engine/gnc-ui-util.h" } #include +#include namespace gnc { @@ -46,6 +48,22 @@ inline QString gchar_to_QString(gchar* tmp_string) return result; } +inline QDateTime toQDateTime(const ::Timespec& timespec) +{ + QDateTime result = QDateTime::fromTime_t(timespec.tv_sec); + result.addMSecs(timespec.tv_nsec / 1000000); + result.setTimeSpec(Qt::UTC); + return result; +} +inline ::Timespec toTimespec(const QDateTime& qdt) +{ + ::Timespec result; + result.tv_sec = qdt.toTime_t(); + result.tv_nsec = qdt.time().msec() * 1000000; + return result; +} + + class PrintAmountInfo : public ::GNCPrintAmountInfo { diff --git a/src/gnc/SplitListModel.cpp b/src/gnc/SplitListModel.cpp index 3556f855c4..632b59532a 100644 --- a/src/gnc/SplitListModel.cpp +++ b/src/gnc/SplitListModel.cpp @@ -56,7 +56,7 @@ int SplitListModel::columnCount(const QModelIndex& parent) const // if (!parent.isValid()) // return 0; // else - return 5; // Fixed number for now + return 6; // Fixed number for now } QVariant SplitListModel::data(const QModelIndex& index, int role) const @@ -71,14 +71,16 @@ QVariant SplitListModel::data(const QModelIndex& index, int role) const switch (index.column()) { case 0: - return trans.getNum(); + return trans.getDatePosted().date().toString(Qt::ISODate); case 1: - return trans.getDescription(); + return trans.getNum(); case 2: - return split.getCorrAccountFullName(); + return trans.getDescription(); case 3: - return QChar(split.getReconcile()); + return split.getCorrAccountFullName(); case 4: + return QChar(split.getReconcile()); + case 5: { Numeric amount = split.getAmount(); // Alternatively: xaccSplitConvertAmount(split.get(), split.getAccount().get()); PrintAmountInfo printInfo(split.get(), true); @@ -112,14 +114,16 @@ QVariant SplitListModel::headerData(int section, Qt::Orientation orientation, in switch (section) { case 0: - return QString("Num"); + return QString("Date"); case 1: - return QString("Description"); + return QString("Num"); case 2: - return QString("Account"); + return QString("Description"); case 3: - return QString("Reconciled?"); + return QString("Account"); case 4: + return QString("Reconciled?"); + case 5: return QString("Amount"); default: return QVariant(); diff --git a/src/gnc/Transaction.hpp b/src/gnc/Transaction.hpp index 8b0cd9e816..ef8f1f4998 100644 --- a/src/gnc/Transaction.hpp +++ b/src/gnc/Transaction.hpp @@ -34,6 +34,7 @@ extern "C" #include "gnc/WeakPointer.hpp" #include "gnc/Account.hpp" #include "gnc/Book.hpp" +#include "gnc/Numeric.hpp" #include #include @@ -60,6 +61,10 @@ public: int countSplits() const { return xaccTransCountSplits(get()); } + void setDatePosted(const QDateTime& t); + void setDateEntered(const QDateTime& t); + QDateTime getDatePosted() const { return toQDateTime(xaccTransRetDatePostedTS(get())); } + QDateTime getDateEntered() const { return toQDateTime(xaccTransRetDateEnteredTS(get())); } }; diff --git a/src/gnc/mainwindow.cpp b/src/gnc/mainwindow.cpp index f62ea8ff28..f3addd3e84 100644 --- a/src/gnc/mainwindow.cpp +++ b/src/gnc/mainwindow.cpp @@ -493,7 +493,7 @@ void MainWindow::loadFile(const QString &fileName) progressBar.setMinimum(0); progressBar.setMaximum(100); statusBar()->showMessage(tr("Loading user data...")); - statusBar()->addWidget(&progressBar); + statusBar()->addPermanentWidget(&progressBar); progressBar.show(); // This local progress_functor is a workaround on how to // pass the suitable function pointer to session_load - @@ -564,7 +564,7 @@ void MainWindow::loadFile(const QString &fileName) QApplication::restoreOverrideCursor(); setCurrentFile(fileName); - statusBar()->showMessage(tr("File loaded"), 2000); + statusBar()->showMessage(tr("File loaded"), 5000); } bool MainWindow::saveFile(const QString &fileName) diff --git a/src/gnc/mainwindow.ui b/src/gnc/mainwindow.ui index 2c5cb09792..ef1cafe1e3 100644 --- a/src/gnc/mainwindow.ui +++ b/src/gnc/mainwindow.ui @@ -113,7 +113,7 @@ p, li { white-space: pre-wrap; } - File + &File @@ -124,14 +124,14 @@ p, li { white-space: pre-wrap; } - Help + &Help - Account + &Account @@ -141,7 +141,7 @@ p, li { white-space: pre-wrap; } - Edit + &Edit @@ -198,7 +198,7 @@ p, li { white-space: pre-wrap; } :/gtk-icons/gtk-save.png:/gtk-icons/gtk-save.png - Save + &Save Save the document to disk @@ -213,7 +213,7 @@ p, li { white-space: pre-wrap; } :/gtk-icons/gtk-save-as.png:/gtk-icons/gtk-save-as.png - Save as... + Save &as... Save the document under a new name @@ -225,7 +225,7 @@ p, li { white-space: pre-wrap; } :/gtk-icons/gtk-quit.png:/gtk-icons/gtk-quit.png - Exit + E&xit Exit the application