Stores and manages datas for a bookkeeping. More...
#include <FdSubWindow.hpp>
Public Member Functions | |
FdSubWindow (QString label, QString currency, QDate initialDate=QDate(), QDate finalDate=QDate(), QString corporation="", QString logo="", QString accountant="") | |
FdSubWindow (QFile *file) | |
FdSubWindow (const FdSubWindow *previousYear) | |
FdModelCoa * | coa () const |
FdModelJournal * | journal () const |
FdModelResults * | results () const |
void | setLabel (QString label) |
void | setCurrency (QString currency) |
void | setInitialDate (QDate date) |
void | setFinalDate (QDate date) |
void | setCorporation (QString corporation) |
void | setLogo (QString logo) |
void | setAccountant (QString accountant) |
QString | label () const |
QString | currency () const |
QDate | initialDate () const |
QDate | finalDate () const |
QString | corporation () const |
QString | logo () const |
QString | accountant () const |
TabRole | getCurrentTabRole () const |
void | save () |
void | saveAs (QString file) |
void | print () |
void | printHeaderFooter (QPrinter &printer, QPainter &painter, QString document, int page) const |
void | addLine () |
void | removeSelected () |
void | copy () |
void | findNext () |
void | recomputeAll () |
void | journalOrderByDate () |
void | journalCopyFromPreviousLine () |
void | showAccount () |
void | showEntry () |
void | setDefaultDockText () const |
Static Public Member Functions | |
static QRect | setPrintArea (QPrinter &printer) |
static void | printTitle (QPainter &painter, QRect &area, QString title) |
static void | printSubtitle (QPainter &painter, QRect &area, QString subtitle) |
static void | printColumnsHeader (QPainter &painter, QRect &area, QList< tableElement * > elements) |
static void | printTableRow (QPainter &painter, QRect &area, QList< tableElement * > elements) |
Protected Member Functions | |
void | closeEvent (QCloseEvent *event) |
Private Slots | |
void | newActiveTab () |
void | closeTab (int index) |
void | cleanStateChanged (bool clean) |
Private Member Functions | |
void | init () |
Private Attributes | |
QString | mLabel |
QString | mCurrency |
QDate | mInitialDate |
QDate | mFinalDate |
QString | mCorporation |
QString | mLogo |
QString | mAccountant |
QFile * | mFile |
QTabWidget * | mTab |
FdViewCoa * | mViewCoa |
FdViewJournal * | mViewJournal |
FdViewResults * | mViewResults |
FdModelCoa * | mCoa |
FdModelJournal * | mJournal |
FdModelResults * | mResults |
Stores and manages datas for a bookkeeping.
FdSubWindow acts as an interface between FdMainWindow and each tab (Coa, journal, results, ...). The central widget of the subwindow is a tab widget (QTabWidget). Each tab contains then a view widget (FdViewCoa, FdViewJournal, ...), with a given #TabRole, set through the dynamic property TabRole (see QObject::property()).
The interface prevents FdMainWindow having to "know" the internal structure of FdModelCoa, FdModelJournal, ... ; FdMainWindow adresses just to FdSubWindow class and no other. So, this class relays signals emmited by menu actions. In the same spirit, tabs return information back to the subwindow through this class (mainly when it comes to update undo/action, see activeTabChanged()).
Each bookkeeping is a FdSubWindow instance. Base data of the bookkeeping, like label, currency, initial and final dates, corporation and accountant name can be set using the access function. FdDialogBkgProperties class provides a graphical interface to set those properties.
Definition at line 49 of file FdSubWindow.hpp.
|
explicit |
The default widget (see QMdiSubWindow::setWidget()) of the subwindow is a QTabWidget, pointed to by mTab.
Definition at line 36 of file FdSubWindow.cpp.
FdSubWindow::FdSubWindow | ( | QFile * | file | ) |
Constructor to create instances from data file.
Definition at line 67 of file FdSubWindow.cpp.
FdSubWindow::FdSubWindow | ( | const FdSubWindow * | previousYear | ) |
Copy constructor to create a new year based on previousYear.
This is no exact copy.
Creates model populated whit items from previousYear models.
Definition at line 101 of file FdSubWindow.cpp.
QString FdSubWindow::accountant | ( | ) | const |
Definition at line 230 of file FdSubWindow.cpp.
void FdSubWindow::addLine | ( | ) |
Relay slot between FdMainWindow::addLine() and FdModelCoa::addItem(), FdModelJournal::addEntry() or FdModelResults::addEntry().
Definition at line 552 of file FdSubWindow.cpp.
|
privateslot |
Toggles subwindow state between cleaned (ie saved) and not clean. This slot recieves QUndoStack::cleanChanged() signal.
Definition at line 784 of file FdSubWindow.cpp.
|
protected |
Handles the close event on the subwindow.
Definition at line 511 of file FdSubWindow.cpp.
|
privateslot |
For the moment, only tabs with role #AccountRole can be closed.
Definition at line 766 of file FdSubWindow.cpp.
FdModelCoa * FdSubWindow::coa | ( | ) | const |
Definition at line 149 of file FdSubWindow.cpp.
void FdSubWindow::copy | ( | ) |
Definition at line 585 of file FdSubWindow.cpp.
QString FdSubWindow::corporation | ( | ) | const |
Definition at line 220 of file FdSubWindow.cpp.
QString FdSubWindow::currency | ( | ) | const |
Definition at line 205 of file FdSubWindow.cpp.
QDate FdSubWindow::finalDate | ( | ) | const |
Definition at line 215 of file FdSubWindow.cpp.
void FdSubWindow::findNext | ( | ) |
Definition at line 610 of file FdSubWindow.cpp.
TabRole FdSubWindow::getCurrentTabRole | ( | ) | const |
Returns the #TabRole of the current widget, ie the #TabRole of the active tab.
Calls QTabWidget::currentIndex() on mTab and retrieves the dynamic property TabRole wich was set in FdSubWindow(), calling QObject::property().
Definition at line 711 of file FdSubWindow.cpp.
|
private |
This function creates views (FdViewCoa, FdViewJournal) and populates them with the corresponding model (FdModelCoa, FdModelJournal). Each view is then set as a tab in mTab (see QTabWidget::addTab()).
Definition at line 123 of file FdSubWindow.cpp.
QDate FdSubWindow::initialDate | ( | ) | const |
Definition at line 210 of file FdSubWindow.cpp.
FdModelJournal * FdSubWindow::journal | ( | ) | const |
Definition at line 154 of file FdSubWindow.cpp.
void FdSubWindow::journalCopyFromPreviousLine | ( | ) |
Relays signal from FdMainWindow::journalCopyFromPreviousLine() and FdModelJournal::copyFromPreviousLine().
If there is no selection, a new row is created and last line is copied.
Definition at line 691 of file FdSubWindow.cpp.
void FdSubWindow::journalOrderByDate | ( | ) |
Relay slot between FdMainWindow::journalOrderByDate() and FdModelJournal::orderByDate().
Definition at line 681 of file FdSubWindow.cpp.
QString FdSubWindow::label | ( | ) | const |
Definition at line 200 of file FdSubWindow.cpp.
QString FdSubWindow::logo | ( | ) | const |
Definition at line 225 of file FdSubWindow.cpp.
|
privateslot |
Called whenever the active tab or subwindow changes. It gets the new tab #TabRole value, the new und/redo actions (if any) and emits the activeTabChanged() signal.
Catches QTabWidget::currentChanged(), to handle tab changing within a FdSubWindow, and QMdiSubWindow::aboutToActivate(), to handle window changing.
Definition at line 723 of file FdSubWindow.cpp.
void FdSubWindow::print | ( | ) |
Definition at line 279 of file FdSubWindow.cpp.
|
static |
Definition at line 456 of file FdSubWindow.cpp.
void FdSubWindow::printHeaderFooter | ( | QPrinter & | printer, |
QPainter & | painter, | ||
QString | document, | ||
int | page | ||
) | const |
Definition at line 367 of file FdSubWindow.cpp.
|
static |
This function prints the subtitle in the given area. area is then reduced by subtitle height.
Definition at line 441 of file FdSubWindow.cpp.
|
static |
Definition at line 480 of file FdSubWindow.cpp.
|
static |
This function prints the title in the given area. area is then reduced by title height.
Definition at line 424 of file FdSubWindow.cpp.
void FdSubWindow::recomputeAll | ( | ) |
Definition at line 670 of file FdSubWindow.cpp.
void FdSubWindow::removeSelected | ( | ) |
Definition at line 566 of file FdSubWindow.cpp.
FdModelResults * FdSubWindow::results | ( | ) | const |
Definition at line 159 of file FdSubWindow.cpp.
void FdSubWindow::save | ( | ) |
Definition at line 235 of file FdSubWindow.cpp.
void FdSubWindow::saveAs | ( | QString | file | ) |
Definition at line 273 of file FdSubWindow.cpp.
void FdSubWindow::setAccountant | ( | QString | accountant | ) |
Definition at line 195 of file FdSubWindow.cpp.
void FdSubWindow::setCorporation | ( | QString | corporation | ) |
Definition at line 185 of file FdSubWindow.cpp.
void FdSubWindow::setCurrency | ( | QString | currency | ) |
Definition at line 170 of file FdSubWindow.cpp.
void FdSubWindow::setDefaultDockText | ( | ) | const |
Definition at line 664 of file FdSubWindow.cpp.
void FdSubWindow::setFinalDate | ( | QDate | date | ) |
Definition at line 180 of file FdSubWindow.cpp.
void FdSubWindow::setInitialDate | ( | QDate | date | ) |
Definition at line 175 of file FdSubWindow.cpp.
void FdSubWindow::setLabel | ( | QString | label | ) |
Definition at line 164 of file FdSubWindow.cpp.
void FdSubWindow::setLogo | ( | QString | logo | ) |
Definition at line 190 of file FdSubWindow.cpp.
|
static |
Definition at line 358 of file FdSubWindow.cpp.
void FdSubWindow::showAccount | ( | ) |
Definition at line 632 of file FdSubWindow.cpp.
void FdSubWindow::showEntry | ( | ) |
Definition at line 654 of file FdSubWindow.cpp.
|
private |
Name of the accountant.
Access functions :
Definition at line 114 of file FdSubWindow.hpp.
|
private |
A pointer to the chart of accounts.
Access functions :
Definition at line 127 of file FdSubWindow.hpp.
|
private |
Corporation or association for which the accountancy is hold.
Access functions :
Definition at line 98 of file FdSubWindow.hpp.
|
private |
Currency of the bookkeeping. Since FreeDebks doesn't provide multicurrency accountancy (yet), this member will be used only for display purposes.
Access functions :
Definition at line 74 of file FdSubWindow.hpp.
|
private |
Definition at line 116 of file FdSubWindow.hpp.
|
private |
Final date of the bookkeeping. No journal entry may be latter than this.
Access functions :
Definition at line 90 of file FdSubWindow.hpp.
|
private |
Initial date of the bookkeeping. No journal entry may be earlier to this.
Access functions :
Definition at line 82 of file FdSubWindow.hpp.
|
private |
Definition at line 128 of file FdSubWindow.hpp.
|
private |
Label of the bookkeeping, has to be filled.
Access functions :
Definition at line 64 of file FdSubWindow.hpp.
|
private |
Corporation or association logo.
Access functions :
Definition at line 106 of file FdSubWindow.hpp.
|
private |
Definition at line 129 of file FdSubWindow.hpp.
|
private |
Definition at line 117 of file FdSubWindow.hpp.
|
private |
Definition at line 118 of file FdSubWindow.hpp.
|
private |
Definition at line 119 of file FdSubWindow.hpp.
|
private |
Definition at line 120 of file FdSubWindow.hpp.