All pastes #1855740 Raw Edit

Stuff

public diff v1 · immutable
#1855740 ·published 2010-04-03 13:09 UTC
rendered paste body
diff --git a/part/CMakeLists.txt b/part/CMakeLists.txtindex f786fda..39b3f76 100644--- a/part/CMakeLists.txt+++ b/part/CMakeLists.txt@@ -217,6 +217,9 @@ endif(KDE4_ENABLE_FINAL) # install kate part interfaces install (TARGETS katepartinterfaces EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) +# install files+install (FILES utils/kate_real_programmers.png DESTINATION ${DATA_INSTALL_DIR}) + # kate part itself just is interfaces + the factory kde4_add_plugin (katepart utils/katefactory.cpp) diff --git a/part/utils/katecmds.cpp b/part/utils/katecmds.cppindex 6b41e79..5c261cc 100644--- a/part/utils/katecmds.cpp+++ b/part/utils/katecmds.cpp@@ -37,8 +37,12 @@ #include <klocale.h> #include <kurl.h> #include <kshellcompletion.h>+#include <kstandarddirs.h>  #include <QtCore/QRegExp>+#include <QtGui/QLabel>+#include <QtGui/QDialog>+#include <QtGui/QBoxLayout>  //BEGIN CoreCommands // syncs a config flag in the document with a boolean value@@ -780,4 +784,21 @@ bool KateCommands::Date::exec (KTextEditor::View *view, const QString &cmd, QStr  //END Date +//BEGIN Butterfly+bool KateCommands::Butterfly::exec (KTextEditor::View *view, const QString &, QString &)+{+  QDialog dialog( view );+  dialog.setModal( true );+  dialog.setWindowTitle( "Real Programmers - http://xkcd.com/378" );+  QLabel label( &dialog );+  label.setPixmap( QPixmap( KGlobal::dirs()->findResource( "data", "kate_real_programmers.png" ) ) );+  label.setToolTip( QString::fromUtf8("I love butterflies, I love *nixkcd, I love KDE, I love Free Software, I love Schrdinger's cat, I love your sister, I love programming!\nScrew EMacs, real programmers use Bleeding-Edge-KatePart!\nBoom de Yada, Boom de Yada!") );+  QHBoxLayout layout( &dialog );+  layout.addWidget( &label );+  dialog.setLayout( &layout );+  dialog.exec();+  return true;+}+//END Butterfly+ // kate: space-indent on; indent-width 2; replace-tabs on;diff --git a/part/utils/katecmds.h b/part/utils/katecmds.hindex f285e16..317047b 100644--- a/part/utils/katecmds.h+++ b/part/utils/katecmds.h@@ -258,6 +258,27 @@ class Date : public KTextEditor::Command     const QStringList &cmds () { static QStringList test("date"); return test; } }; +class Butterfly : public KTextEditor::Command+{+  public:+    /**+     * execute command+     * @param view view to use for execution+     * @param cmd cmd string+     * @param errorMsg error to return if no success+     * @return success+     */+    bool exec (class KTextEditor::View *view, const QString &cmd, QString &errorMsg);++    /** This command does not have help. @see KTextEditor::Command::help */+    bool help (class KTextEditor::View *, const QString &, QString &) { return false; }++    /**+     * supported commands as prefixes+     * @return prefix list+     */+    const QStringList &cmds () { static QStringList test("butterfly"); return test; }+};  } // namespace KateCommands #endifdiff --git a/part/utils/kateglobal.cpp b/part/utils/kateglobal.cppindex eeb7aaf..901bf4c 100644--- a/part/utils/kateglobal.cpp+++ b/part/utils/kateglobal.cpp@@ -171,11 +171,12 @@ KateGlobal::KateGlobal ()   //   // init the cmds   //-  m_cmds.push_back (new KateCommands::CoreCommands());-  m_cmds.push_back (new KateCommands::ViCommands());+  m_cmds.push_back (new KateCommands::CoreCommands ());+  m_cmds.push_back (new KateCommands::ViCommands ());   m_cmds.push_back (new KateCommands::SedReplace ());   m_cmds.push_back (new KateCommands::Character ());   m_cmds.push_back (new KateCommands::Date ());+  m_cmds.push_back (new KateCommands::Butterfly ());    for ( QList<KTextEditor::Command *>::iterator it = m_cmds.begin(); it != m_cmds.end(); ++it )     m_cmdManager->registerCommand (*it);diff --git a/part/vimode/kateviinsertmode.cpp b/part/vimode/kateviinsertmode.cppindex e89fd6a..5ee277a 100644--- a/part/vimode/kateviinsertmode.cpp+++ b/part/vimode/kateviinsertmode.cpp@@ -194,7 +194,6 @@ bool KateViInsertMode::handleKeypress( const QKeyEvent *e )     case Qt::Key_Escape:       startNormalMode();       return true;-      break;     case Qt::Key_Left:       m_view->cursorLeft();       return true;