FreeDebks  1.0.3
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
FdSubWindow Class Reference

Stores and manages datas for a bookkeeping. More...

#include <FdSubWindow.hpp>

Collaboration diagram for FdSubWindow:
Collaboration graph
[legend]

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)
FdModelCoacoa () const
FdModelJournaljournal () const
FdModelResultsresults () 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
FdViewCoamViewCoa
FdViewJournalmViewJournal
FdViewResultsmViewResults
FdModelCoamCoa
FdModelJournalmJournal
FdModelResultsmResults

Detailed Description

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.

Constructor & Destructor Documentation

FdSubWindow::FdSubWindow ( QString  label,
QString  currency,
QDate  initialDate = QDate(),
QDate  finalDate = QDate(),
QString  corporation = "",
QString  logo = "",
QString  accountant = "" 
)
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.

Member Function Documentation

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.

void FdSubWindow::cleanStateChanged ( bool  clean)
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.

void FdSubWindow::closeEvent ( QCloseEvent *  event)
protected

Handles the close event on the subwindow.

Definition at line 511 of file FdSubWindow.cpp.

void FdSubWindow::closeTab ( int  index)
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.

void FdSubWindow::init ( )
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.

void FdSubWindow::newActiveTab ( )
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.

void FdSubWindow::printColumnsHeader ( QPainter &  painter,
QRect &  area,
QList< tableElement * >  elements 
)
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.

void FdSubWindow::printSubtitle ( QPainter &  painter,
QRect &  area,
QString  subtitle 
)
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.

void FdSubWindow::printTableRow ( QPainter &  painter,
QRect &  area,
QList< tableElement * >  elements 
)
static

Definition at line 480 of file FdSubWindow.cpp.

void FdSubWindow::printTitle ( QPainter &  painter,
QRect &  area,
QString  title 
)
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.

QRect FdSubWindow::setPrintArea ( QPrinter &  printer)
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.

Member Data Documentation

QString FdSubWindow::mAccountant
private

Name of the accountant.

Access functions :

Definition at line 114 of file FdSubWindow.hpp.

FdModelCoa* FdSubWindow::mCoa
private

A pointer to the chart of accounts.

Access functions :

  • const FdModelCoa* getCoa() const

Definition at line 127 of file FdSubWindow.hpp.

QString FdSubWindow::mCorporation
private

Corporation or association for which the accountancy is hold.

Access functions :

Definition at line 98 of file FdSubWindow.hpp.

QString FdSubWindow::mCurrency
private

Currency of the bookkeeping. Since FreeDebks doesn't provide multicurrency accountancy (yet), this member will be used only for display purposes.

Access functions :

See Also
QWidget::windowTitle

Definition at line 74 of file FdSubWindow.hpp.

QFile* FdSubWindow::mFile
private

Definition at line 116 of file FdSubWindow.hpp.

QDate FdSubWindow::mFinalDate
private

Final date of the bookkeeping. No journal entry may be latter than this.

Access functions :

Definition at line 90 of file FdSubWindow.hpp.

QDate FdSubWindow::mInitialDate
private

Initial date of the bookkeeping. No journal entry may be earlier to this.

Access functions :

Definition at line 82 of file FdSubWindow.hpp.

FdModelJournal* FdSubWindow::mJournal
private

Definition at line 128 of file FdSubWindow.hpp.

QString FdSubWindow::mLabel
private

Label of the bookkeeping, has to be filled.

Access functions :

Definition at line 64 of file FdSubWindow.hpp.

QString FdSubWindow::mLogo
private

Corporation or association logo.

Access functions :

Definition at line 106 of file FdSubWindow.hpp.

FdModelResults* FdSubWindow::mResults
private

Definition at line 129 of file FdSubWindow.hpp.

QTabWidget* FdSubWindow::mTab
private

Definition at line 117 of file FdSubWindow.hpp.

FdViewCoa* FdSubWindow::mViewCoa
private

Definition at line 118 of file FdSubWindow.hpp.

FdViewJournal* FdSubWindow::mViewJournal
private

Definition at line 119 of file FdSubWindow.hpp.

FdViewResults* FdSubWindow::mViewResults
private

Definition at line 120 of file FdSubWindow.hpp.


The documentation for this class was generated from the following files: