Browse Source

Finish porting completion now that the KatePart at least does something with it. (Argument hints still to do.)

git-svn-id: file:///var/svn/tigccpp/trunk@1173 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 17 years ago
parent
commit
ae492d5ef6
2 changed files with 3 additions and 36 deletions
  1. 3 34
      ktigcc/completion.cpp
  2. 0 2
      ktigcc/completion.h

+ 3 - 34
ktigcc/completion.cpp

@@ -654,34 +654,13 @@ CompletionPopup::CompletionPopup(KTextEditor::View *parent, const QString &fileN
         column--;
     }
   }
-#if 0 // FIXME: Finish porting completion.
-  connect(parent,SIGNAL(completionAborted()),this,SLOT(slotDone()));
-  connect(parent,SIGNAL(completionDone()),this,SLOT(slotDone()));
+  connect(parent,SIGNAL(completionAborted(KTextEditor::View*)),this,SLOT(slotDone()));
+  connect(parent,SIGNAL(completionExecuted(KTextEditor::View*,const KTextEditor::Cursor&,KTextEditor::CodeCompletionModel*,int)),this,SLOT(slotDone()));
   KTextEditor::CodeCompletionInterface *complIFace
     =qobject_cast<KTextEditor::CodeCompletionInterface *>(parent);
-  qDebug("%s",parent->document()->text(KTextEditor::Range(
-                                KTextEditor::Cursor(line,column),cursor)).utf8().data());
   complIFace->startCompletion(KTextEditor::Range(
                                 KTextEditor::Cursor(line,column),cursor),
                               new CompletionModel(this,entries));
-  // Unfortunately, Kate doesn't always send the completionAborted or
-  // completionDone event when it closes its popup. Work around that.
-  QWidgetList *list=QApplication::topLevelWidgets();
-  QWidgetListIt it(*list);
-  while (QWidget *w=it.current()) {
-    ++it;
-    if (w->isVisible() && w->testWFlags(Qt::WType_Popup)
-        && !std::strcmp(w->className(),"QVBox")) {
-      completionPopup=w;
-      break;
-    }
-  }
-  delete list;
-  if (completionPopup)
-    completionPopup->installEventFilter(this);
-#else
-  slotDone();
-#endif
 }
 
 void CompletionPopup::slotDone()
@@ -693,16 +672,6 @@ void CompletionPopup::slotDone()
   }
 }
 
-bool CompletionPopup::eventFilter(QObject *o, QEvent *e)
-{
-  if (!done && o==completionPopup && e->type()==QEvent::Hide) {
-    done=true;
-    emit closed();
-    deleteLater();
-  }
-  return false;
-}
-
 ArgHintPopup::ArgHintPopup(KTextEditor::View *parent, const QString &fileName,
                            MainForm *mainForm)
   : QObject(parent), done(false), argHintPopup(0)
@@ -729,7 +698,7 @@ ArgHintPopup::ArgHintPopup(KTextEditor::View *parent, const QString &fileName,
   QString identifier=textLine.mid(startColumn,endColumn-startColumn);
   QStringList prototypes=prototypesForIdentifier(identifier,entries);
   if (prototypes.isEmpty()) goto nothingFound;  
-#if 0 // FIXME: Port argument hint.
+#if 0 // FIXME: Rewrite argument hint.
   connect(parent,SIGNAL(argHintHidden()),this,SLOT(slotDone()));
   parent->showArgHint(prototypes,"()",",");
   // Unfortunately, Kate doesn't always send the argHintHidden event when it

+ 0 - 2
ktigcc/completion.h

@@ -128,8 +128,6 @@ class CompletionPopup : public QObject {
     void slotDone();
   signals:
     void closed();
-  protected:
-    bool eventFilter(QObject *o, QEvent *e);
   private:
     bool done;
     QWidget *completionPopup;