Browse Source

Port to new KDE 3.91.0 interface:
* no more KTextEditor::HighlightingInterface, hliface->setHighlighting -> document->setHighlightingMode
* KRun::runCommand now takes a QWidget * as a second parameter, pass 'this' pointer


git-svn-id: file:///var/svn/tigccpp/trunk@1166 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler 17 years ago
parent
commit
8d823d1669
3 changed files with 13 additions and 35 deletions
  1. 2 2
      ktigcc/NEWS
  2. 9 26
      ktigcc/mainform.cpp
  3. 2 7
      ktigcc/srcfilewin.cpp

+ 2 - 2
ktigcc/NEWS

@@ -1,11 +1,11 @@
 This is a summary of the changes in KTIGCC since the first alpha release:
 
-CVS HEAD (2007-06-17):
+CVS HEAD (2007-06-30):
 
 * Added a full changelog (generated from CVS logs).
 * Fixed stray indentation at the end of the line when autoclosing a curly brace
   as ENTER is pressed.
-* Ported to KDE 3.90.1.
+* Ported to KDE 3.91.0.
 * Fixed highlighting update when moving a file to Header Files from another
   editable category. (The first character was read from the wrong buffer.)
 * Don't hardcode ~/.kde for the KDE(4)HOME directory.

+ 9 - 26
ktigcc/mainform.cpp

@@ -121,7 +121,6 @@ class DnDListView : public K3ListView {
 #include <ktexteditor/smartinterface.h>
 #include <ktexteditor/commandinterface.h>
 #include <ktexteditor/configinterface.h>
-#include <ktexteditor/highlightinginterface.h>
 #include <kconfig.h>
 #include <kconfiggroup.h>
 #include <ktexteditor/configpage.h>
@@ -609,11 +608,8 @@ void DnDListView::dropEvent(QDropEvent *e) {
               && IS_EDITABLE_CATEGORY(destCategory)
               && srcCategory!=destCategory) {
             // update highlighting mode
-            KTextEditor::HighlightingInterface *hliface
-              =qobject_cast<KTextEditor::HighlightingInterface*>(
-                static_cast<ListViewFile *>(currItem)->kateView->document());
             QString fileText=static_cast<ListViewFile *>(currItem)->kateView->document()->text();
-            hliface->setHighlighting(
+            static_cast<ListViewFile *>(currItem)->kateView->document()->setHighlightingMode(
               (destCategory==qllFilesListItem?
                 QLL_HL_MODE:
               (destCategory==sFilesListItem||(destCategory==hFilesListItem&&!fileText.isNull()&&!fileText.isEmpty()&&fileText[0]=='|'))?
@@ -1890,11 +1886,9 @@ void *MainForm::createView(const QString &fileName, const QString &fileText, Q3L
   newView->hide();
   newView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored,0,0));
   // Set highlighting mode.
-  KTextEditor::HighlightingInterface *hliface
-    =qobject_cast<KTextEditor::HighlightingInterface*>(newView->document());
   QString firstLine;
   if (doc->lines()) firstLine=doc->line(0);
-  hliface->setHighlighting(
+  newView->document()->setHighlightingMode(
     (category==qllFilesListItem?
       QLL_HL_MODE:
     (category==sFilesListItem||(category==hFilesListItem&&!firstLine.isEmpty()&&firstLine[0]=='|'))?
@@ -1996,9 +1990,7 @@ void MainForm::adoptSourceFile(void *srcFile)
   COUNTER_FOR_CATEGORY(category)++;
   // Set highlighting mode.
   QString fileText=newView->document()->text();
-  KTextEditor::HighlightingInterface *hliface
-    =qobject_cast<KTextEditor::HighlightingInterface*>(newView->document());
-  hliface->setHighlighting(
+  newView->document()->setHighlightingMode(
     (category==qllFilesListItem?
       QLL_HL_MODE:
     (category==sFilesListItem||(category==hFilesListItem&&!fileText.isNull()&&!fileText.isEmpty()&&fileText[0]=='|'))?
@@ -2605,27 +2597,20 @@ void MainForm::filePreferences()
       if (IS_FILE(item)) {
         KTextEditor::View *kateView=static_cast<ListViewFile *>(item)->kateView;
         if (kateView) {
-          KTextEditor::HighlightingInterface *hliface
-            =qobject_cast<KTextEditor::HighlightingInterface*>(kateView->document());
-          hliface->setHighlighting("None");
+          kateView->document()->setHighlightingMode("None");
         }
       }
     }
     foreach (SourceFileWindow *sourceFile, sourceFiles) {
-      KTextEditor::HighlightingInterface *hliface
-        =qobject_cast<KTextEditor::HighlightingInterface*>(
-          sourceFile->kateView->document());
-      hliface->setHighlighting("None");
+      sourceFile->kateView->document()->setHighlightingMode("None");
     }
     KParts::Factory *factory=(KParts::Factory *)
       KLibLoader::self()->factory("katepart");
     if (!factory) qFatal("Failed to load KatePart");
     KTextEditor::Document *doc=(KTextEditor::Document *)
       factory->createPart(0,this,"KTextEditor::Document");
-    KTextEditor::HighlightingInterface *hliface
-      =qobject_cast<KTextEditor::HighlightingInterface*>(doc);
-    hliface->setHighlighting("Asm6502"); // Don't ask...
-    hliface->setHighlighting("None");
+    doc->setHighlightingMode("Asm6502"); // Don't ask...
+    doc->setHighlightingMode("None");
     KTextEditor::Editor *editor=doc->editor();
     int numConfigPages=editor->configPages();
     for (int i=0; i<numConfigPages; i++) {
@@ -2664,9 +2649,7 @@ void MainForm::filePreferences()
             8
           );
           // Kate seems really insisting on making it a pain to update syntax highlighting settings.
-          KTextEditor::HighlightingInterface *hliface
-            =qobject_cast<KTextEditor::HighlightingInterface*>(kateView->document());
-          hliface->setHighlighting(
+          kateView->document()->setHighlightingMode(
             (category==qllFilesListItem?
               QLL_HL_MODE:
             (category==sFilesListItem||(category==hFilesListItem&&!fileText.isNull()&&!fileText.isEmpty()&&fileText[0]=='|'))?
@@ -4855,7 +4838,7 @@ void MainForm::debugRun()
           // Fire up TiEmu if it isn't running yet.
           if (!tiemuInstance(tiemuDBus)) return;
           if (!tiemuDBus) {
-            if (!KRun::runCommand("tiemu")) {
+            if (!KRun::runCommand("tiemu", this)) {
               KMessageBox::error(this,"Can't run TiEmu.");
               return;
             }

+ 2 - 7
ktigcc/srcfilewin.cpp

@@ -53,7 +53,6 @@
 #include <ktexteditor/view.h>
 #include <ktexteditor/cursor.h>
 #include <ktexteditor/range.h>
-#include <ktexteditor/highlightinginterface.h>
 #include <ktexteditor/configinterface.h>
 #include <kconfig.h>
 #include <ktexteditor/configpage.h>
@@ -509,9 +508,7 @@ void *SourceFileWindow::createView(const QString &fileName, const QString &hlMod
   newView->hide();
   newView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored,0,0));
   // Set highlighting mode.
-  KTextEditor::HighlightingInterface *hliface
-    =qobject_cast<KTextEditor::HighlightingInterface*>(newView->document());
-  hliface->setHighlighting(hlModeName);
+  newView->document()->setHighlightingMode(hlModeName);
   // Set options.
   KTextEditor::ConfigInterface *configiface
     =qobject_cast<KTextEditor::ConfigInterface*>(newView);
@@ -661,9 +658,7 @@ void SourceFileWindow::applyPreferences()
     setTabWidth(kateView,isASMFile?preferences.tabWidthAsm:
                          isCFile?preferences.tabWidthC:8);
     // Kate seems really insisting on making it a pain to update syntax highlighting settings.
-    KTextEditor::HighlightingInterface *hliface
-      =qobject_cast<KTextEditor::HighlightingInterface*>(kateView->document());
-    hliface->setHighlighting(HL_MODE);
+    kateView->document()->setHighlightingMode(HL_MODE);
     // Force redrawing to get the tab width right, repaint() is ignored for some reason.
     kateView->hide();
     kateView->show();