[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/office/skrooge
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2011-01-10 13:19:04
Message-ID: 20110110131904.A64B03E1F1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1213467 by smankowski:

Robustness

 M  +2 -0      skg_bookmark/skgbookmarkplugindockwidget.cpp  
 M  +1 -0      skg_dashboard/skgdashboardpluginwidget.cpp  
 M  +2 -0      skg_dashboard2/skgdashboard2pluginwidget.cpp  
 M  +2 -0      skg_debug/skgdebugpluginwidget.cpp  
 M  +1 -0      skg_properties/skgpropertiesplugindockwidget.cpp  
 M  +1 -0      skg_undoredo/skgundoredoplugindockwidget.cpp  
 M  +4 -3      skgbankgui/skgprocesscreator.cpp  
 M  +3 -2      skgbankgui/skgpropertyeditor.cpp  
 M  +1 -1      skgbankmodeler/skgbudgetobject.cpp  
 M  +5 -2      skgbasegui/skgfilteredtableview.cpp  
 M  +11 -1     skgbasegui/skgshow.cpp  
 M  +1 -0      skrooge_bank/skgbankpluginwidget.cpp  
 M  +8 -3      skrooge_budget/skgbudgetpluginwidget.cpp  
 M  +1 -0      skrooge_calculator/skgcalculatorpluginwidget.cpp  
 M  +1 -0      skrooge_categories/skgcategoriespluginwidget.cpp  
 M  +1 -0      skrooge_monthly/skgmonthlypluginwidget.cpp  
 M  +1 -0      skrooge_operation/skgoperationpluginwidget.cpp  
 M  +1 -0      skrooge_payee/skgpayeepluginwidget.cpp  
 M  +8 -8      skrooge_report/skgreportpluginwidget.cpp  
 M  +1 -0      skrooge_scheduled/skgscheduledpluginwidget.cpp  
 M  +1 -0      skrooge_search/skgsearchpluginwidget.cpp  
 M  +1 -0      skrooge_tracker/skgtrackerpluginwidget.cpp  
 M  +1 -0      skrooge_unit/skgunitpluginwidget.cpp  
 M  +1 -0      templates/skrooge_xxx/skgxxxpluginwidget.cpp  


--- trunk/extragear/office/skrooge/skg_bookmark/skgbookmarkplugindockwidget.cpp \
#1213466:1213467 @@ -41,6 +41,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGBookmarkPluginDockWidget::SKGBookmarkPluginDockWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
@@ -106,6 +107,7 @@
     m_actAddBookmarkGroup = NULL;
     m_actSetAutostart = NULL;
     m_actUnsetAutostart = NULL;
+    m_modelview = NULL;
 }
 
 QWidget* SKGBookmarkPluginDockWidget::mainWidget() const
--- trunk/extragear/office/skrooge/skg_dashboard/skgdashboardpluginwidget.cpp \
#1213466:1213467 @@ -41,6 +41,7 @@
     : SKGTabPage(iDocument), m_flowLayout(NULL), m_menu(NULL), m_addMenu(NULL), \
m_currentIndex(-1)  {
     SKGTRACEIN(1, "SKGDashboardPluginWidget::SKGDashboardPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skg_dashboard2/skgdashboard2pluginwidget.cpp \
#1213466:1213467 @@ -51,6 +51,8 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGDashboard2PluginWidget::SKGDashboard2PluginWidget");
+    if(!iDocument) return;
+
     KMessageBox::information(this, iDocument->getFileExtension());
 
     ui.setupUi(this);
--- trunk/extragear/office/skrooge/skg_debug/skgdebugpluginwidget.cpp \
#1213466:1213467 @@ -32,6 +32,8 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(10, "SKGDebugPluginWidget::SKGDebugPluginWidget");
+    if(!iDocument) return;
+
     ui.setupUi(this);
 
     //Set icons
--- trunk/extragear/office/skrooge/skg_properties/skgpropertiesplugindockwidget.cpp \
#1213466:1213467 @@ -39,6 +39,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGPropertiesPluginDockWidget::SKGPropertiesPluginDockWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skg_undoredo/skgundoredoplugindockwidget.cpp \
#1213466:1213467 @@ -32,6 +32,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGUndoRedoPluginDockWidget::SKGUndoRedoPluginDockWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skgbankgui/skgprocesscreator.cpp #1213466:1213467
@@ -24,7 +24,8 @@
 #include <qdom.h>
 #include "skgpredicatcreator.h"
 
-SKGProcessCreator::SKGProcessCreator(QWidget* parent): QWidget(parent)
+SKGProcessCreator::SKGProcessCreator(QWidget* parent):
+    QWidget(parent), m_document(NULL)
 {
     ui.setupUi(this);
     ui.addLineBtn->setIcon(KIcon("list-add"));
@@ -34,7 +35,7 @@
 
 SKGProcessCreator::~SKGProcessCreator()
 {
-
+    m_document = NULL;
 }
 
 SKGPropertyEditor* SKGProcessCreator::addLine()
@@ -66,7 +67,7 @@
     // Remove all existing lines
     for(int i = 0; ui.propertyLinesLayout->count(); i++) {
         QLayoutItem*line = ui.propertyLinesLayout->takeAt(i);
-        line->widget()->deleteLater();
+        if(line) line->widget()->deleteLater();
     }
     QDomNode l = root.firstChild();
     while(!l.isNull()) {
--- trunk/extragear/office/skrooge/skgbankgui/skgpropertyeditor.cpp #1213466:1213467
@@ -22,7 +22,8 @@
 #include "skgpropertyeditor.h"
 #include <QListWidget>
 
-SKGPropertyEditor::SKGPropertyEditor(QWidget* parent): QWidget(parent)
+SKGPropertyEditor::SKGPropertyEditor(QWidget* parent):
+    QWidget(parent), m_document(NULL)
 {
     ui.setupUi(this);
 
@@ -51,7 +52,7 @@
 
 SKGPropertyEditor::~SKGPropertyEditor()
 {
-
+    m_document = NULL;
 }
 
 void SKGPropertyEditor::setParameters(SKGDocument* iDocument, const QString& iTable, \
                const QStringList& iEditableAttribute, const QStringList& \
                iOtherAttributes)
--- trunk/extragear/office/skrooge/skgbankmodeler/skgbudgetobject.cpp \
#1213466:1213467 @@ -248,7 +248,7 @@
         double sumOps = 0;
 
         int nbval = listTmp.count();
-        if(err.isSucceeded()) {
+        if(err.isSucceeded() && iDocument) {
             int step = 0;
             err = iDocument->beginTransaction("#INTERNAL#", nbval - 1 + 4);
 
--- trunk/extragear/office/skrooge/skgbasegui/skgfilteredtableview.cpp \
#1213466:1213467 @@ -26,7 +26,7 @@
 #include <klineedit.h>
 
 SKGFilteredTableView::SKGFilteredTableView(QWidget *parent)
-    : QWidget(parent)
+    : QWidget(parent), m_objectModel(NULL)
 {
     ui.setupUi(this);
 
@@ -35,6 +35,7 @@
 
 SKGFilteredTableView::~SKGFilteredTableView()
 {
+    m_objectModel = NULL;
 }
 
 QString SKGFilteredTableView::getState()
@@ -100,7 +101,7 @@
 {
     Q_UNUSED(iIdTransaction);
 
-    if(iTableName == m_objectModel->getRealTable() || iTableName.isEmpty()) {
+    if((m_objectModel && iTableName == m_objectModel->getRealTable()) || \
                iTableName.isEmpty()) {
         if(getView()->isAutoResized()) getView()->resizeColumnsToContentsDelayed();
 
         getView()->onSelectionChanged();
@@ -109,6 +110,7 @@
 void SKGFilteredTableView::setModel(SKGObjectModelBase* iModel)
 {
     m_objectModel = iModel;
+    if(m_objectModel) {
     SKGSortFilterProxyModel* modelProxy = new SKGSortFilterProxyModel(this);
     modelProxy->setSourceModel(m_objectModel);
     modelProxy->setSortRole(Qt::UserRole);
@@ -123,6 +125,7 @@
     connect(m_objectModel, SIGNAL(beforeReset()), ui.kView, SLOT(saveSelection()));
     connect(m_objectModel, SIGNAL(afterReset()), ui.kView, SLOT(resetSelection()));
     connect(m_objectModel->getDocument(), SIGNAL(tableModified(QString, int)), this, \
SLOT(dataModified(QString, int)), Qt::QueuedConnection); +    }
     dataModified("", 0);
 }
 
--- trunk/extragear/office/skrooge/skgbasegui/skgshow.cpp #1213466:1213467
@@ -53,18 +53,21 @@
 QString SKGShow::getState()
 {
     QStringList itemsChecked;
+    if(m_menu) {
     QList<QAction*> actions = m_menu->actions();
     int nb = actions.count();
     for(int i = 0; i < nb; ++i) {
         QAction* act = actions.at(i);
         if(act && act->isChecked()) itemsChecked.push_back(act->data().toString());
     }
+    }
     return SKGServices::stringsToCsv(itemsChecked);
 }
 
 QString SKGShow::getWhereClause()
 {
     QString wc;
+    if(m_menu) {
     QList<QAction*> actions = m_menu->actions();
     int nb = actions.count();
     bool noCheck = true;
@@ -82,6 +85,7 @@
         };
     }
     if(nb && noCheck) wc = "1=0";
+    }
     return wc;
 }
 
@@ -93,6 +97,7 @@
 
 void SKGShow::setState(const QString& iState)
 {
+    if(m_menu) {
     QStringList itemsChecked = SKGServices::splitCSVLine(iState.isEmpty() ? \
m_defaultState : iState);  
     QList<QAction*> actions = m_menu->actions();
@@ -102,6 +107,7 @@
         if(act) act->setChecked(itemsChecked.contains(act->data().toString()));
     }
 }
+}
 
 void SKGShow::addItem(const QString& iIdentifier, const QString& iText, const \
QString& iIcon,  const QString& iWhereClose,
@@ -111,6 +117,7 @@
                       const QString& iListIdToUncheckWhenUnchecked
                      )
 {
+    if(m_menu) {
     QAction* act = m_menu->addAction(iText);
     if(act) {
         act->setIcon(KIcon(iIcon));
@@ -129,10 +136,11 @@
 
     show();
 }
+}
 
 void SKGShow::addSeparator()
 {
-    m_menu->addSeparator();
+    if(m_menu) m_menu->addSeparator();
 }
 
 void SKGShow::itemChanged()
@@ -190,12 +198,14 @@
 QAction* SKGShow::getAction(const QString& iIdentifier)
 {
     QAction* output = NULL;
+    if(m_menu) {
     QList<QAction*> actions = m_menu->actions();
     int nb = actions.count();
     for(int i = 0; !output && i < nb; ++i) {
         QAction* act = actions.at(i);
         if(act && act->data().toString() == iIdentifier) output = act;
     }
+    }
     return output;
 }
 
--- trunk/extragear/office/skrooge/skrooge_bank/skgbankpluginwidget.cpp \
#1213466:1213467 @@ -42,6 +42,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(10, "SKGBankPluginWidget::SKGBankPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_budget/skgbudgetpluginwidget.cpp \
#1213466:1213467 @@ -36,6 +36,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGBudgetPluginWidget::SKGBudgetPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
@@ -111,7 +112,7 @@
     ui.kModeCmb->addItem(i18nc("Noun, mode item to a apply a transfer of budget", \
"Current year"), SKGBudgetRuleObject::YEAR);  
     SKGDocumentBank* doc = static_cast<SKGDocumentBank*>(getDocument());
-
+    if(doc) {
     ui.kUnitCmb->addItem("%");
     ui.kUnitCmb->addItem(doc->getPrimaryUnit().Symbol);
     ui.kUnit->setText(doc->getPrimaryUnit().Symbol);
@@ -119,6 +120,7 @@
     //Bind operation view
     m_objectModel = new SKGObjectModel(doc, "v_budget_display", "1=0", this, "", \
false);  ui.kView->setModel(m_objectModel);
+    }
 
     //Add registered global action in contextual menu
     if(SKGMainPanel::getMainPanel()) {
@@ -177,7 +179,7 @@
     doc.appendChild(root);
 
     root.setAttribute("currentPage", SKGServices::intToString(getCurrentMode()));
-    if(m_objectModel->getRealTable() == "budget") {
+    if(m_objectModel && m_objectModel->getRealTable() == "budget") {
         root.setAttribute("view", ui.kView->getState());
         root.setAttribute("viewRule", m_viewRule);
     } else {
@@ -202,7 +204,7 @@
 
     m_viewBudget = root.attribute("view");
     m_viewRule = root.attribute("viewRule");
-    if(m_objectModel->getRealTable() == "budget") {
+    if(m_objectModel && m_objectModel->getRealTable() == "budget") {
         ui.kView->setState(m_viewBudget);
     } else {
         ui.kView->setState(m_viewRule);
@@ -252,6 +254,7 @@
 void SKGBudgetPluginWidget::setCurrentMode(int iMode)
 {
     SKGTRACEIN(10, "SKGBudgetPluginWidget::setCurrentMode");
+    if(!m_objectModel) return;
     if(iMode == 2 && m_mode != 2) {
         ui.kView->getShowWidget()->setEnabled(false);
         m_viewBudget = ui.kView->getState();
@@ -531,6 +534,7 @@
 void SKGBudgetPluginWidget::onDoubleClick()
 {
     _SKGTRACEIN(10, "SKGBudgetPluginWidget::onDoubleClick");
+    if(!m_objectModel) return;
 
     //Get selection
     SKGObjectBase::SKGListSKGObjectBase selection = getSelectedObjects();
@@ -555,6 +559,7 @@
 void SKGBudgetPluginWidget::onSelectionChanged()
 {
     SKGTRACEIN(10, "SKGBudgetPluginWidget::onSelectionChanged");
+    if(!m_objectModel) return;
 
     SKGObjectBase::SKGListSKGObjectBase objs = getSelectedObjects();
     int nb = objs.count();
--- trunk/extragear/office/skrooge/skrooge_calculator/skgcalculatorpluginwidget.cpp \
#1213466:1213467 @@ -42,6 +42,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGCalculatorPluginWidget::SKGCalculatorPluginWidget");
+    if(!iDocument) return;
 
     m_timer.setSingleShot(true);
     connect(&m_timer, SIGNAL(timeout()), this, SLOT(onAmortizationComputation()));
--- trunk/extragear/office/skrooge/skrooge_categories/skgcategoriespluginwidget.cpp \
#1213466:1213467 @@ -41,6 +41,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(10, "SKGCategoriesPluginWidget::SKGCategoriesPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_monthly/skgmonthlypluginwidget.cpp \
#1213466:1213467 @@ -42,6 +42,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGMonthlyPluginWidget::SKGMonthlyPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_operation/skgoperationpluginwidget.cpp \
#1213466:1213467 @@ -54,6 +54,7 @@
       m_numberFieldIsNotUptodate(true), m_modeInfoZone(0)
 {
     SKGTRACEIN(1, "SKGOperationPluginWidget::SKGOperationPluginWidget");
+    if(!iDocument) return;
 
     *NOUPDATE = "-------";
 
--- trunk/extragear/office/skrooge/skrooge_payee/skgpayeepluginwidget.cpp \
#1213466:1213467 @@ -36,6 +36,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGPayeePluginWidget::SKGPayeePluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_report/skgreportpluginwidget.cpp \
#1213466:1213467 @@ -39,6 +39,7 @@
     : SKGTabPage(iDocument), m_nbLevelLines(0), m_nbLevelColumns(0)
 {
     SKGTRACEIN(10, "SKGReportPluginWidget::SKGReportPluginWidget");
+    if(!iDocument) return;
 
     m_timer.setSingleShot(true);
     connect(&m_timer, SIGNAL(timeout()), this, SLOT(refreshActivated()));
@@ -74,7 +75,7 @@
         QStringList overlayopen;
         overlayopen.push_back("skg_open");
         m_openReportAction = tableMenu->addAction(KIcon("view-statistics", NULL, \
                overlayopen), i18nc("Verb", "Open report..."));
-        m_openReportAction->setEnabled(false);
+        if(m_openReportAction) m_openReportAction->setEnabled(false);
     }
 
     KMenu* graphMenu = ui.kTableWithGraph->getGraphContextualMenu();
@@ -151,6 +152,7 @@
 SKGReportPluginWidget::~SKGReportPluginWidget()
 {
     SKGTRACEIN(10, "SKGReportPluginWidget::~SKGReportPluginWidget");
+    m_openReportAction = NULL;
 }
 
 int SKGReportPluginWidget::getCurrentMode()
@@ -724,7 +726,7 @@
 
 void SKGReportPluginWidget::onSelectionChanged()
 {
-    m_openReportAction->setEnabled(ui.kTableWithGraph->table()->selectedItems().count() \
> 0); +    if(m_openReportAction) \
> m_openReportAction->setEnabled(ui.kTableWithGraph->table()->selectedItems().count() \
> > 0);
 }
 
 void SKGReportPluginWidget::refresh()
@@ -776,8 +778,10 @@
     if(db != NULL) {
         //Check if needed
         if(iTableName == "operation" || iTableName.isEmpty()) {
+            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+            SKGError err;
             SKGDocumentBank* doc = static_cast<SKGDocumentBank*>(getDocument());
-
+            if(doc) {
             //Check if update is needed
             QString ParametersUsed = getState() + ';' + \
SKGServices::intToString(doc->getTransactionToProcess());  if(ParametersUsed == \
m_previousParametersUsed) { @@ -786,8 +790,6 @@
             }
             m_previousParametersUsed = ParametersUsed;
 
-            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-
             //Fill line and create title
             QString lineString;
             QString title;
@@ -806,9 +808,6 @@
             ui.kLineLabel->setVisible(nb > 0);
             ui.kLineLabel->setText(lineString);
 
-            //Fill table
-            SKGError err;
-
             //Get parameters
             int col = ui.kColumns->currentIndex();
             int line = ui.kLines->currentIndex();
@@ -1151,6 +1150,7 @@
                     ui.kColUp->setEnabled(m_nbLevelColumns < nbLevelColMax);
                 }
             }
+            }
 
             QApplication::restoreOverrideCursor();
 
--- trunk/extragear/office/skrooge/skrooge_scheduled/skgscheduledpluginwidget.cpp \
#1213466:1213467 @@ -37,6 +37,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGScheduledPluginWidget::SKGScheduledPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_search/skgsearchpluginwidget.cpp \
#1213466:1213467 @@ -39,6 +39,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGSearchPluginWidget::SKGSearchPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_tracker/skgtrackerpluginwidget.cpp \
#1213466:1213467 @@ -34,6 +34,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGTrackerPluginWidget::SKGTrackerPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/skrooge_unit/skgunitpluginwidget.cpp \
#1213466:1213467 @@ -42,6 +42,7 @@
     : SKGTabPage(iDocument)
 {
     SKGTRACEIN(10, "SKGUnitPluginWidget::SKGUnitPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 
--- trunk/extragear/office/skrooge/templates/skrooge_xxx/skgxxxpluginwidget.cpp \
#1213466:1213467 @@ -30,6 +30,7 @@
         : SKGTabPage(iDocument)
 {
     SKGTRACEIN(1, "SKGXXXPluginWidget::SKGXXXPluginWidget");
+    if(!iDocument) return;
 
     ui.setupUi(this);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic