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

List:       kde-commits
Subject:    KDE/kdebase/kate/app
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2007-01-13 8:26:47
Message-ID: 1168676807.599884.19579.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 622826 by cullmann:

fix freeze if any errors appear ;) show the errors message box after restore only if \
the eventloop is already up and running right...

 M  +1 -11     kateapp.cpp  
 M  +15 -6     katedocmanager.cpp  
 M  +3 -2      katedocmanager.h  


--- trunk/KDE/kdebase/kate/app/kateapp.cpp #622825:622826
@@ -155,24 +155,14 @@
 
 void KateApp::restoreKate ()
 {
-  // restore the nice files ;) we need it
-#ifdef __GNUC__
-  #warning fixme later
-#endif
-  //KTextEditor::Document::setOpenErrorDialogsActivated (false);
-
   // activate again correct session!!!
   sessionConfig()->setGroup("General");
   QString lastSession (sessionConfig()->readEntry ("Last Session", \
"default.katesession"));  sessionManager()->activateSession \
(KSharedPtr<KateSession>(new KateSession (sessionManager(), lastSession)), false, \
false, false);  
+  // restore the files we need
   m_docManager->restoreDocumentList (sessionConfig());
 
-#ifdef __GNUC__
-#warning fixme later
-#endif
-  //KTextEditor::Document::setOpenErrorDialogsActivated (true);
-
   // restore all windows ;)
   for (int n=1; KMainWindow::canBeRestored(n); n++)
     newMainWindow(sessionConfig(), QString ("%1").arg(n));
--- trunk/KDE/kdebase/kate/app/katedocmanager.cpp #622825:622826
@@ -49,11 +49,13 @@
 #include <QHash>
 #include <QListView>
 #include <QStandardItem>
+#include <QTimer>
 
 KateDocManager::KateDocManager (QObject *parent)
  : QStandardItemModel (parent)
  , m_saveMetaInfos(true)
  , m_daysMetaInfos(0)
+ , m_documentStillToRestore (0)
 {
   // Constructed the beloved editor ;)
   m_editor = KTextEditor::EditorChooser::editor();
@@ -460,8 +462,8 @@
 
   bool first = true;
   const int countM1=count-1;
+  m_documentStillToRestore = count;
   m_restoringDocumentList=true;
-  m_documentsBeingRestored.clear();
   m_openingErrors.clear();
   for (unsigned int i=0; i < count; i++)
   {
@@ -476,16 +478,13 @@
     else
       doc = createDoc ();
     doc->setSuppressOpeningErrorDialogs(true);
-    m_documentsBeingRestored.insert(doc,true);
     connect(doc,SIGNAL(completed()),this,SLOT(documentOpened()));
     connect(doc,SIGNAL(canceled(const QString&)),this,SLOT(documentOpened()));
-    if (i==countM1) m_restoringDocumentList=false;
     if (KTextEditor::SessionConfigInterface *iface = \
qobject_cast<KTextEditor::SessionConfigInterface *>(doc))  \
iface->readSessionConfig(config);  config->setGroup (grp);
 
     pd->progressBar()->setValue(pd->progressBar()->value()+1);
-    KateApp::self()->processEvents();
   }
   m_restoringDocumentList=false;
   delete pd;
@@ -640,11 +639,21 @@
     disconnect(doc,SIGNAL(canceled(const QString&)),this,SLOT(documentOpened()));
     if (doc->openingError())
       m_openingErrors+='\n'+doc->openingErrorMessage();
-    m_documentsBeingRestored.take(doc);
-    if ((m_restoringDocumentList==false) && (m_documentsBeingRestored.count()==0)) {
+    --m_documentStillToRestore;
+
+    if (m_documentStillToRestore == 0)
+      QTimer::singleShot(0, this, SLOT(showRestoreErrors()));
+}
+
+void KateDocManager::showRestoreErrors ()
+{
+  if (!m_openingErrors.isEmpty()) {
       KMessageBox::information (0,
         m_openingErrors,
         i18n ("Errors/Warnings while opening documents"));
+
+      // clear errors
+      m_openingErrors.clear ();
     }
 }
 
--- trunk/KDE/kdebase/kate/app/katedocmanager.h #622825:622826
@@ -102,7 +102,6 @@
     void saveDocumentList (class KConfig *config);
     void restoreDocumentList (class KConfig *config);
 
-
     inline bool getSaveMetaInfos() { return m_saveMetaInfos; };
     inline void setSaveMetaInfos(bool b) { m_saveMetaInfos = b; };
 
@@ -130,6 +129,8 @@
     void slotModChanged1(KTextEditor::Document *doc);
     void slotDocumentNameChanged(KTextEditor::Document *document);
     void slotDocumentUrlChanged(KTextEditor::Document *doc);
+
+    void showRestoreErrors ();
   private:
     bool loadMetaInfos(KTextEditor::Document *doc, const KUrl &url);
     void saveMetaInfos(KTextEditor::Document *doc);
@@ -153,8 +154,8 @@
     QString m_dbusObjectPath;
     QMap<KTextEditor::Document*,QStandardItem*> m_documentItemMapping;
     bool m_restoringDocumentList;
-    QMap<KTextEditor::Document*,bool> m_documentsBeingRestored;
     QString m_openingErrors;
+    int m_documentStillToRestore;
   private Q_SLOTS:
     void documentOpened();
 };


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

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