packages: kde4-kdelibs/kde4-kdelibs-branch.diff - merged from DEVEL

shadzik shadzik at pld-linux.org
Thu Feb 18 00:16:41 CET 2010


Author: shadzik                      Date: Wed Feb 17 23:16:40 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- merged from DEVEL

---- Files affected:
packages/kde4-kdelibs:
   kde4-kdelibs-branch.diff (1.17 -> 1.18) 

---- Diffs:

================================================================
Index: packages/kde4-kdelibs/kde4-kdelibs-branch.diff
diff -u packages/kde4-kdelibs/kde4-kdelibs-branch.diff:1.17 packages/kde4-kdelibs/kde4-kdelibs-branch.diff:1.18
--- packages/kde4-kdelibs/kde4-kdelibs-branch.diff:1.17	Wed Dec  2 19:12:41 2009
+++ packages/kde4-kdelibs/kde4-kdelibs-branch.diff	Thu Feb 18 00:16:35 2010
@@ -1,327 +1,3481 @@
-Index: kio/kio/slave.cpp
+Index: interfaces/ktexteditor/templateinterface.cpp
 ===================================================================
---- kio/kio/slave.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kio/kio/slave.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -125,9 +125,10 @@
- void Slave::timeout()
- {
-     Q_D(Slave);
-+   if (d->dead)
-+      return;
-    if (d->connection->isConnected())
-       return;
--
-    kDebug(7002) << "slave failed to connect to application pid=" << d->m_pid << " protocol=" << d->m_protocol;
-    if (d->m_pid && (::kill(d->m_pid, 0) == 0))
-    {
-Index: kio/kio/jobuidelegate.cpp
-===================================================================
---- kio/kio/jobuidelegate.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kio/kio/jobuidelegate.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -79,17 +79,19 @@
-                                                      sizeSrc, sizeDest,
-                                                      ctimeSrc, ctimeDest, mtimeSrc,
-                                                      mtimeDest);
-+    connect(job, SIGNAL(finished(KJob*)), &dlg, SLOT(reject())); // #192976
-     KIO::RenameDialog_Result res = static_cast<RenameDialog_Result>(dlg.exec());
-     newDest = dlg.newDestUrl().path();
-     return res;
- }
- 
--KIO::SkipDialog_Result KIO::JobUiDelegate::askSkip(KJob *,
-+KIO::SkipDialog_Result KIO::JobUiDelegate::askSkip(KJob *job,
-                                               bool multi,
-                                               const QString & error_text)
- {
-     // We now do it in process. So this method is a useless wrapper around KIO::open_RenameDialog.
-     KIO::SkipDialog dlg( window(), multi, error_text );
-+    connect(job, SIGNAL(finished(KJob*)), &dlg, SLOT(reject())); // #192976
-     return static_cast<KIO::SkipDialog_Result>(dlg.exec());
- }
- 
-Index: kio/kio/kzip.h
-===================================================================
---- kio/kio/kzip.h	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kio/kio/kzip.h	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -149,9 +149,7 @@
-     /// Closes the archive
-     virtual bool closeArchive();
+--- interfaces/ktexteditor/templateinterface.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ interfaces/ktexteditor/templateinterface.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -114,7 +114,7 @@
+ {
+   QMap<QString, QString> enhancedInitValues( initialValues );
  
--    /**
--     * @internal Not needed for zip
--     */
-+    /// Reimplemented from KArchive
-     virtual bool doWriteDir( const QString& name, const QString& user,
-                              const QString& group, mode_t perm, time_t atime,
-                              time_t mtime, time_t ctime );
-Index: kio/kio/karchive.cpp
+-  QRegExp rx( "[$%]\\{([^}\\s]+)\\}" );
++  QRegExp rx( "[$%]\\{([^}\\r\\n]+)\\}" );
+   rx.setMinimal( true );
+   int pos = 0;
+   int offset;
+Index: kate/dialogs/katedialogs.cpp
+===================================================================
+--- kate/dialogs/katedialogs.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/dialogs/katedialogs.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -743,6 +743,10 @@
+   ui->cmbDynamicWordWrapIndicator->addItem( i18n("Follow Line Numbers") );
+   ui->cmbDynamicWordWrapIndicator->addItem( i18n("Always On") );
+ 
++  // hide power user mode if activated anyway
++  if (!KateGlobal::self()->simpleMode ())
++    ui->chkDeveloperMode->hide ();
++    
+   // What's This? help is in the ui-file
+ 
+   reload();
+Index: kate/syntax/katehighlight.h
+===================================================================
+--- kate/syntax/katehighlight.h	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/syntax/katehighlight.h	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -223,6 +223,7 @@
+      * the returned string is used as key for m_additionalData.
+      */
+     QString hlKeyForAttrib( int attrib ) const;
++    QString hlKeyForContext( int attrib ) const;
+ 
+     int defaultStyleForAttribute( int attrib ) const;
+ 
+@@ -377,7 +378,7 @@
+      * @see hlKeyForAttrib
+      */
+     QMap<int, QString> m_hlIndex;
+-
++    QMap<int, QString> m_ctxIndex;
+   public:
+     inline bool foldingIndentationSensitive () { return m_foldingIndentationSensitive; }
+     inline bool allowsFolding(){return folding;}
+Index: kate/syntax/katehighlight.cpp
 ===================================================================
---- kio/kio/karchive.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kio/kio/karchive.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -351,7 +351,7 @@
-                          mode_t perm, time_t atime,
-                          time_t mtime, time_t ctime )
+--- kate/syntax/katehighlight.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/syntax/katehighlight.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -84,6 +84,7 @@
+     m_additionalData["none"]->deliminator = stdDeliminator;
+     m_additionalData["none"]->wordWrapDeliminator = stdDeliminator;
+     m_hlIndex[0] = "none";
++    m_ctxIndex[0]="";
+   }
+   else
+   {
+@@ -951,6 +952,20 @@
+   return true;
+ }
+ 
++QString KateHighlighting::hlKeyForContext(int i) const
++{
++  int k = 0;
++  QMap<int,QString>::const_iterator it = m_ctxIndex.constEnd();
++  while ( it != m_hlIndex.constBegin() )
++  {
++    --it;
++    k = it.key();
++    if ( i >= k )
++      break;
++  }
++  return it.value();
++}
++
+ QString KateHighlighting::hlKeyForAttrib( int i ) const
+ {
+   // find entry. This is faster than QMap::find. m_hlIndex always has an entry
+@@ -1651,7 +1666,7 @@
+  */
+ int KateHighlighting::addToContextList(const QString &ident, int ctx0)
  {
--    return doWriteDir( name, user, group, perm, atime, mtime, ctime );
-+    return doWriteDir( name, user, group, perm | 040000, atime, mtime, ctime );
+-  kDebug(13010)<<"=== Adding hl with ident '"<<ident<<"'";
++  //kDebug(13010)<<"=== Adding hl with ident '"<<ident<<"' ctx0="<<ctx0;
+ 
+   buildIdentifier=ident;
+   KateSyntaxContextData *data, *datasub;
+@@ -1678,6 +1693,7 @@
+   RegionList<<"!KateInternal_TopLevel!";
+ 
+   m_hlIndex[internalIDList.count()] = ident;
++  m_ctxIndex[ctx0]=ident;
+   m_additionalData.insert( ident, new HighlightPropertyBag );
+ 
+   // fill out the propertybag
+Index: kate/smart/katesmartregion.cpp
+===================================================================
+--- kate/smart/katesmartregion.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/smart/katesmartregion.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -55,6 +55,8 @@
+     else
+       *m_bounding = m_bounding->encompass(*range);
+   }
++
++  m_bounding->setInternal();
+ }
+ 
+ 
+Index: kate/utils/kateglobal.cpp
+===================================================================
+--- kate/utils/kateglobal.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/kateglobal.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -157,9 +157,8 @@
+   m_viewConfig = new KateViewConfig ();
+   m_rendererConfig = new KateRendererConfig ();
+ 
+-  // create script manager (search scripts) + register commands
++  // create script manager (search scripts)
+   m_scriptManager = new KateScriptManager ();
+-  KateCmd::self()->registerCommand (m_scriptManager);
+ 
+   //
+   // plugin manager
+Index: kate/utils/katecmd.cpp
+===================================================================
+--- kate/utils/katecmd.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/katecmd.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -48,6 +48,7 @@
+   }
+ 
+   m_cmds += l;
++  m_cmdCompletion.insertItems(l);
+ 
+   return true;
+ }
+@@ -64,6 +65,7 @@
+ 
+   for ( QStringList::Iterator it1 = l.begin(); it1 != l.end(); ++it1 ) {
+     m_dict.remove(*it1);
++    m_cmdCompletion.removeItem(*it1);
+     //kDebug(13050)<<"Removed command:"<<*it1;
+   }
+ 
+@@ -119,6 +121,11 @@
+     return QString();
+   return m_history[ index ];
+ }
++
++KCompletion* KateCmd::commandCompletionObject()
++{
++  return &m_cmdCompletion;
++}
+ //END KateCmd
+ 
+ //BEGIN KateCmdShellCompletion
+Index: kate/utils/kateconfig.cpp
+===================================================================
+--- kate/utils/kateconfig.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/kateconfig.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -1392,6 +1392,7 @@
+   KColorScheme schemeView(QPalette::Active, KColorScheme::View);
+   KColorScheme schemeWindow(QPalette::Active, KColorScheme::Window);
+   KColorScheme schemeSelection(QPalette::Active, KColorScheme::Selection);
++  KColorScheme schemeTooltip(QPalette::Active, KColorScheme::Tooltip);
+   QColor tmp0( schemeView.background().color() );
+   QColor tmp1( schemeSelection.background().color() );
+   QColor tmp2( schemeView.background(KColorScheme::AlternateBackground).color() );
+@@ -1446,11 +1447,18 @@
+   m_fontMetrics = QFontMetrics(m_font);
+   m_fontSet = true;
+ 
+-  m_templateBackgroundColor=config.readEntry(QString("Color Template Background"),QColor(0xcc,0xcc,0xcc));
+-  m_templateEditablePlaceholderColor = config.readEntry(QString("Color Template Editable Placeholder"),QColor(0xcc,0xff,0xcc));
+-  m_templateFocusedEditablePlaceholderColor=config.readEntry(QString("Color Template Focused Editable Placeholder"),QColor(0x66,0xff,0x66));
+-  m_templateNotEditablePlaceholderColor=config.readEntry(QString("Color Template Not Editable Placeholder"),QColor(0xff,0xcc,0xcc));
++  m_templateBackgroundColor=config.readEntry(QString("Color Template Background"),
++                                             schemeTooltip.background(KColorScheme::NormalBackground).color());
+ 
++  m_templateEditablePlaceholderColor = config.readEntry(QString("Color Template Editable Placeholder"),
++                                                        schemeTooltip.background(KColorScheme::NeutralBackground).color());
++
++  m_templateFocusedEditablePlaceholderColor=config.readEntry(QString("Color Template Focused Editable Placeholder"),
++                                                             schemeTooltip.background(KColorScheme::PositiveBackground).color());
++
++  m_templateNotEditablePlaceholderColor=config.readEntry(QString("Color Template Not Editable Placeholder"),
++                                                         schemeTooltip.background(KColorScheme::NegativeBackground).color());
++
+   m_templateColorsSet=true;
  }
  
- bool KArchive::writeSymLink(const QString &name, const QString &target,
-@@ -729,7 +729,9 @@
+Index: kate/utils/katecmd.h
+===================================================================
+--- kate/utils/katecmd.h	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/katecmd.h	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -45,10 +45,13 @@
+     const QString fromHistory( int i ) const;
+     uint historyLength() const { return m_history.count(); }
+ 
++    KCompletion* commandCompletionObject();
++
+   private:
+     QHash<QString, KTextEditor::Command *> m_dict;
+     QStringList m_cmds;
+     QStringList m_history;
++    KCompletion m_cmdCompletion; // shared completion object for all KateCmdLineEdits in each KTE::View
+ };
+ 
+ /**
+Index: kate/utils/katetemplatehandler.cpp
+===================================================================
+--- kate/utils/katetemplatehandler.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/katetemplatehandler.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -39,6 +39,12 @@
+ 
+ #define ifDebug(x) x
+ 
++/// just like Range::contains() but returns true when the cursor is at the end of the range
++bool customContains(SmartRange* range, const Cursor& cursor)
++{
++  return range->start() <= cursor && range->end() >= cursor;
++}
++
+ /* ####################################### */
  
- void KArchiveDirectory::addEntry( KArchiveEntry* entry )
+ KateTemplateHandler::KateTemplateHandler( KateDocument *doc, const Cursor& position,
+@@ -49,6 +55,9 @@
  {
--  Q_ASSERT( !entry->name().isEmpty() );
-+  if( entry->name().isEmpty() )
-+    return;
+   ifDebug(kDebug() << templateString << initialValues;)
+ 
++  connect(m_doc, SIGNAL(aboutToReload(KTextEditor::Document*)),
++          this, SLOT(cleanupAndExit()));
 +
-   if( d->entries.value( entry->name() ) ) {
-       kWarning() << "directory " << name()
-                   << "has entry" << entry->name() << "already";
-Index: kio/kio/kzip.cpp
-===================================================================
---- kio/kio/kzip.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kio/kio/kzip.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -995,9 +995,15 @@
-     return true;
+   connect(m_doc, SIGNAL(textInserted(KTextEditor::Document*, KTextEditor::Range)),
+           this, SLOT(slotTemplateInserted(KTextEditor::Document*, KTextEditor::Range)));
+ 
+@@ -162,7 +171,8 @@
+ void KateTemplateHandler::jumpToFinalCursorPosition()
+ {
+   if ( m_doc->activeView() && (!m_wholeTemplateRange
+-        || m_wholeTemplateRange->contains(m_doc->activeView()->cursorPosition())) ) {
++        || customContains(m_wholeTemplateRange, m_doc->activeView()->cursorPosition())) )
++  {
+     m_doc->activeView()->setSelection(Range::invalid());
+     m_doc->activeView()->setCursorPosition(*m_finalCursorPosition);
+   }
+@@ -295,12 +305,12 @@
  }
  
--bool KZip::doWriteDir( const QString&, const QString&, const QString&,
--                       mode_t, time_t, time_t, time_t ) {
--        return true;
-+bool KZip::doWriteDir( const QString &name, const QString &user, const QString &group,
-+                       mode_t perm, time_t atime, time_t mtime, time_t ctime ) {
-+    // Zip files have no explicit directories, they are implicitly created during extraction time
-+    // when file entries have paths in them.
-+    // However, to support empty directories, we must create a dummy file entry which ends with '/'.
-+    QString dirName = name;
-+    if (!name.endsWith("/"))
-+        dirName = dirName.append('/');
-+    return writeFile(dirName, user, group, 0, 0, perm, atime, mtime, ctime);
- }
- 
- bool KZip::doPrepareWriting(const QString &name, const QString &user,
-Index: kio/tests/jobtest.cpp
-===================================================================
---- kio/tests/jobtest.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kio/tests/jobtest.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -1130,7 +1130,7 @@
- 
- void JobTest::getInvalidUrl()
- {
--    KUrl url("file://\"\"");
-+    KUrl url("http://[strange;hostname]/");
-     QVERIFY(!url.isValid());
- 
-     KIO::SimpleJob* job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
-Index: kdecore/sycoca/ksycocafactory.cpp
-===================================================================
---- kdecore/sycoca/ksycocafactory.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kdecore/sycoca/ksycocafactory.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -31,7 +31,10 @@
- class KSycocaFactory::Private
+ /**
+- * Returns an attribute with \p color as background with 0x88 alpha value.
++ * Returns an attribute with \p color as background with @p alpha alpha value.
+  */
+-Attribute::Ptr getAttribute(QColor color)
++Attribute::Ptr getAttribute(QColor color, int alpha = 230)
  {
- public:
--    Private() {}
-+    Private() : mOffset(0),
-+                m_sycocaDictOffset(0),
-+                m_beginEntryOffset(0),
-+                m_endEntryOffset(0) {}
-     ~Private()
+   Attribute::Ptr attribute(new Attribute());
+-  color.setAlpha(0x88);
++  color.setAlpha(alpha);
+   attribute->setBackground(QBrush(color));
+   return attribute;
+ }
+@@ -433,12 +443,12 @@
+ 
+   Attribute::Ptr editableAttribute = getAttribute(config->templateEditablePlaceholderColor());
+   editableAttribute->setDynamicAttribute(
+-      Attribute::ActivateCaretIn, getAttribute(config->templateFocusedEditablePlaceholderColor())
++      Attribute::ActivateCaretIn, getAttribute(config->templateFocusedEditablePlaceholderColor(), 255)
+   );
+ 
+   Attribute::Ptr mirroredAttribute = getAttribute(config->templateNotEditablePlaceholderColor());
+ 
+-  m_wholeTemplateRange->setAttribute(getAttribute(config->templateBackgroundColor()));
++  m_wholeTemplateRange->setAttribute(getAttribute(config->templateBackgroundColor(), 200));
+   m_doc->addHighlightToDocument(m_wholeTemplateRange, true);
+ 
+   // create smart ranges for each found variable
+@@ -520,7 +530,7 @@
+   SmartRange* leftAdjacentRange = 0;
+ 
+   foreach ( SmartRange* parent, m_templateRanges ) {
+-    if ( parent->start() <= range.start() && parent->end() >= range.start() )
++    if ( customContains(parent, range.start()) )
      {
-         delete m_sycocaDict;
-Index: kdecore/services/kmimetypefactory.cpp
+       if ( parent->childRanges().isEmpty() ) {
+         // simple, not-mirrored range got changed
+@@ -543,7 +553,7 @@
+         } else {
+           // find mirrored range that got edited
+           foreach ( SmartRange* child, parent->childRanges() ) {
+-            if ( child->start() <= range.start() && child->end() >= range.start() ) {
++            if ( customContains(child, range.start()) ) {
+               baseRange = child;
+               break;
+             }
+Index: kate/utils/katetemplatehandler.h
 ===================================================================
---- kdecore/services/kmimetypefactory.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kdecore/services/kmimetypefactory.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -29,15 +29,16 @@
- 
- KMimeTypeFactory::KMimeTypeFactory()
-     : KSycocaFactory( KST_KMimeTypeFactory ),
-+      m_fastPatternOffset(0),
-+      m_highWeightPatternOffset(0),
-+      m_lowWeightPatternOffset(0),
-+      m_parentsMapOffset(0),
-       m_highWeightPatternsLoaded(false),
-       m_lowWeightPatternsLoaded(false),
-       m_parentsMapLoaded(false),
-       m_magicFilesParsed(false)
- {
-     kMimeTypeFactoryInstance->instanceCreated(this);
--    m_fastPatternOffset = 0;
--    m_highWeightPatternOffset = 0;
--    m_lowWeightPatternOffset = 0;
-     if (!KSycoca::self()->isBuilding()) {
-         QDataStream* str = stream();
-         Q_ASSERT(str);
-Index: kdecore/tests/kurltest.cpp
-===================================================================
---- kdecore/tests/kurltest.cpp	(.../tags/KDE/4.3.4/kdelibs)	(wersja 1057516)
-+++ kdecore/tests/kurltest.cpp	(.../branches/KDE/4.3/kdelibs)	(wersja 1057516)
-@@ -1452,26 +1452,32 @@
-   weird = "http://strange<username>@strange<hostname>/";
-   QVERIFY( !weird.isValid() );
- 
--  weird = "http://strange<username>@ok_hostname/";
-+  weird = "http://strange<username>@hostname/";
-   QVERIFY( weird.isValid() ); // KDE3: was valid. Fixed by _setEncodedUrl.
--  QCOMPARE( weird.host(), QString("ok_hostname") );
-+  QCOMPARE( weird.host(), QString("hostname") );
- 
-   weird = "http://strange;hostname/";
-+#if QT_VERSION < 0x040600
-   QVERIFY( weird.isValid() ); // KDE3: was invalid. bah*2.
-+#endif
+--- kate/utils/katetemplatehandler.h	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/katetemplatehandler.h	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -144,6 +144,13 @@
+     void syncMirroredRanges(KTextEditor::SmartRange* range);
+ 
+     /**
++     * Jumps to the final cursor position. This is either \p m_finalCursorPosition, or
++     * if that is not set, the end of \p m_templateRange.
++     */
++    void jumpToFinalCursorPosition();
++
++  private Q_SLOTS:
++    /**
+      * Cleans up the template handler and deletes it.
+      *
+      * We cannot always do that blindly in the dtor, as it would crash
+@@ -153,13 +160,6 @@
+     void cleanupAndExit();
+ 
+     /**
+-     * Jumps to the final cursor position. This is either \p m_finalCursorPosition, or
+-     * if that is not set, the end of \p m_templateRange.
+-     */
+-    void jumpToFinalCursorPosition();
+-
+-  private Q_SLOTS:
+-    /**
+      * Saves the range of the inserted template. This is required since
+      * tabs could get expanded on insert. While we are at it, we can
+      * use it to auto-indent the code after insert.
+Index: kate/utils/katecmds.cpp
+===================================================================
+--- kate/utils/katecmds.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/utils/katecmds.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -680,11 +680,19 @@
+ 
+   int replacementsDone = 0;
+   int linesTouched = 0;
++  int linesAdded = 0;
+ 
+   if (r.isValid()) { // given range
+-    for (int line = r.start().line(); line <= r.end().line(); line++) {
++    for (int line = r.start().line(); line <= r.end().line()+linesAdded; line++) {
+       int temp = replacementsDone;
+-      replacementsDone += sedMagic( doc, line, find, replace, d, !noCase, repeat );
++      int r = sedMagic( doc, line, find, replace, d, !noCase, repeat );
++      replacementsDone += r;
++
++      // if we replaced the text with n newlines, we have n new lines to look at
++      if (replace.contains('\n') ) {
++        linesAdded += r * replace.count('\n');
++      }
++
+       if (replacementsDone > temp) {
+         linesTouched++;
+       }
+Index: kate/script/katecommandlinescript.cpp
+===================================================================
+--- kate/script/katecommandlinescript.cpp	(.../tags/KDE/4.4.0/kdelibs)	(wersja 1091888)
++++ kate/script/katecommandlinescript.cpp	(.../branches/KDE/4.4/kdelibs)	(wersja 1091888)
+@@ -25,13 +25,21 @@
+ 
+ #include "katedocument.h"
+ #include "kateview.h"
++#include "katecmd.h"
++#include "kshell.h"
+ 
+ KateCommandLineScript::KateCommandLineScript(const QString &url, const KateCommandLineScriptHeader &header)
+   : KateScript(url)
+   , m_header(header)
+ {
++  KateCmd::self()->registerCommand (this);
+ }
  
-   weird = "http://strange;username@strange;hostname/";
-+#if QT_VERSION < 0x040600
-   QVERIFY( weird.isValid() ); // KDE3: was invalid. bah*3.
-+#endif
++KateCommandLineScript::~KateCommandLineScript()
++{
++  KateCmd::self()->unregisterCommand (this);
++}
++
+ const KateCommandLineScriptHeader& KateCommandLineScript::header()
+ {
+   return m_header;
+@@ -64,9 +72,44 @@
+   return true;
+ }
  
--  weird = "http://strange;username@ok_hostname/";
-+  weird = "http://strange;username@hostname/";
-   QVERIFY( weird.isValid() );
--  QCOMPARE( weird.host(), QString("ok_hostname") );
-+  QCOMPARE( weird.host(), QString("hostname") );
- 
-   weird = "http://strange;username:password@strange;hostname/";
-+#if QT_VERSION < 0x040600
-   QVERIFY( weird.isValid() ); // KDE3: was invalid
-+#endif
++const QStringList &KateCommandLineScript::cmds ()
++{
++  return m_header.functions();
++}
++
++bool KateCommandLineScript::exec (KTextEditor::View *view, const QString &_cmd, QString &errorMsg)
++{
++  KShell::Errors errorCode;
++  QStringList args(KShell::splitArgs(_cmd, KShell::NoOptions, &errorCode));
++
++  if (errorCode != KShell::NoError) {
++    errorMsg = i18n("Bad quoting in call: %1. Please escape single quotes with a backslash.", _cmd);
++    return false;
++  }
++
++  QString cmd(args.first());
++  args.removeFirst();
++
++  if (!view) {
++    errorMsg = i18n("Could not access view");
++    return false;
++  }
++
++  if (setView(qobject_cast<KateView*>(view))) {
++    // setView fails, if the script cannot be loaded
++    return callFunction(cmd, args, errorMsg);
++  }
++
++  return false;
++}
++
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kde4-kdelibs/kde4-kdelibs-branch.diff?r1=1.17&r2=1.18&f=u



More information about the pld-cvs-commit mailing list