diff -Nru kdevplatform-0.9.98/CMakeLists.txt kdevplatform-1.0.1/CMakeLists.txt
--- kdevplatform-0.9.98/CMakeLists.txt 2010-02-10 19:26:12.000000000 +0000
+++ kdevplatform-1.0.1/CMakeLists.txt 2010-07-17 20:04:26.000000000 +0100
@@ -6,9 +6,9 @@
set(CMAKE_MODULE_PATH ${KDevPlatform_SOURCE_DIR}/cmake/modules)
-set(KDEVPLATFORM_VERSION_MAJOR 0)
-set(KDEVPLATFORM_VERSION_MINOR 9)
-set(KDEVPLATFORM_VERSION_PATCH 98)
+set(KDEVPLATFORM_VERSION_MAJOR 1)
+set(KDEVPLATFORM_VERSION_MINOR 0)
+set(KDEVPLATFORM_VERSION_PATCH 1)
set(KDE_MIN_VERSION "4.3.0")
find_package(KDE4 4.3.0 REQUIRED)
@@ -18,6 +18,16 @@
include (MacroWriteBasicCMakeVersionFile)
include (MacroLibrary)
+# Make sure that we're having RPATH on our installed libs, else using kdevelop
+# from prefixes like $HOME/kdevelop breaks
+# Code taken from FindKDE4Internal.cmake for KDE 4.5
+list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${LIB_INSTALL_DIR}"
+ _isSystemLibDir)
+if("${_isSystemLibDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
+endif("${_isSystemLibDir}" STREQUAL "-1")
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
set(KOMPARE_FOUND FALSE)
#macro_optional_find_package(Kompare)
macro_bool_to_01(KOMPARE_FOUND HAVE_KOMPARE)
@@ -30,6 +40,18 @@
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+if(CMAKE_COMPILER_IS_GNUCXX)
+ # TODO: Remove when LTS for g++ < 4.3 has ended.
+ # See also: languages/cpp/parser/parser.h
+ macro_ensure_version("4.3.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_3)
+ if (GCC_IS_NEWER_THAN_4_3)
+ message(STATUS "Enabling c++0x support for unordered map")
+ add_definitions( -std=c++0x ) # For unordered_map
+ else(GCC_IS_NEWER_THAN_4_3)
+ add_definitions( -DGXX_LT_4_3 )
+ endif (GCC_IS_NEWER_THAN_4_3)
+endif(CMAKE_COMPILER_IS_GNUCXX)
+
include_directories(${KDevPlatform_SOURCE_DIR} ${KDevPlatform_BINARY_DIR} ${KDE4_INCLUDES})
set(KDEVPLATFORM_LIB_VERSION 1.0.0)
@@ -86,3 +108,6 @@
# Put this last, so it can use _kdevplatform_CONFIG_DEST
add_subdirectory(cmake)
+
+include(MacroOptionalAddSubdirectory)
+macro_optional_add_subdirectory( po )
diff -Nru kdevplatform-0.9.98/debian/changelog kdevplatform-1.0.1/debian/changelog
--- kdevplatform-0.9.98/debian/changelog 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/changelog 2010-08-11 07:45:41.000000000 +0100
@@ -1,93 +1,101 @@
-kdevplatform (0.9.98-0ubuntu1) lucid; urgency=low
+kdevplatform (1.0.1-1ubuntu2~ppa1) lucid; urgency=low
- * New upstream release
- - Update kdevplatform1-libs.install
- - Add kdevsnippet.rc to kdevplatform1-libs.install
- - Add igenericprojectmanager.h to kdevplatform-dev.install
+ * Backport to Lucid
- -- Alessandro Ghersi Sat, 13 Feb 2010 04:15:07 +0100
+ -- Emanuele Wed, 11 Aug 2010 08:44:57 +0200
-kdevplatform (0.9.97a-0ubuntu1) lucid; urgency=low
+kdevplatform (1.0.1-1ubuntu1) maverick; urgency=low
- * Upstream released a new source tar
+ * Add export KUBUNTU_DESKTOP_POT=extragear-sdk_kdevplatform
- -- Jonathan Riddell Wed, 16 Dec 2009 12:44:40 +0000
+ -- Jonathan Riddell Mon, 26 Jul 2010 18:21:06 +0100
-kdevplatform (0.9.97-0ubuntu2) lucid; urgency=low
+kdevplatform (1.0.1-1) unstable; urgency=low
- * Remove FindKDevPlatform.cmake from kdevplatform-dev.install, it's in
- kdelibs in 4.4
+ * New upstream release.
- -- Jonathan Riddell Tue, 15 Dec 2009 00:14:15 +0000
+ [ Fathi Boudra ]
+ * Add localization packages: Finnish (fi), Dutch (nl), Slovenian (sl) and
+ Thai (th).
+ * Update debian/control:
+ - bump Standards-Version to 3.9.0 (no changes needed).
+ - comment turkish localization package, not shipped in this release.
+ * Update debian/rules: remove workaround for FindKDE4Internal.cmake default
+ rpath value, fixed in kdelibs5-dev 4.4.1.
-kdevplatform (0.9.97-0ubuntu1) lucid; urgency=low
+ [ Sune Vuorela ]
+ * Remove hardcoded dependency in libsublime1 on kdelibs5.
- * New upstream release
+ -- Fathi Boudra Thu, 22 Jul 2010 20:36:46 +0300
- -- Jonathan Riddell Mon, 14 Dec 2009 20:53:21 +0000
+kdevplatform (1.0.0-1) unstable; urgency=low
-kdevplatform (0.9.96-1ubuntu1) lucid; urgency=low
+ * New upstream release.
- * Merge with Debian testing, remaining changes:
- - Use a versioned boost build-dep
- * Bump build-depend version on kdelibs5-dev to (>= 4:4.3.3-0ubuntu4) to
- ensure we build with Qt 4.6 RC1
+ -- Jeremy Lainé Mon, 03 May 2010 22:24:13 +0200
- -- Jonathan Thomas Wed, 25 Nov 2009 09:03:37 -0500
-
-kdevplatform (0.9.96-1) unstable; urgency=low
+kdevplatform (0.10.2-1) unstable; urgency=low
* New upstream release.
- * Add 01_kdevplatform_r1044088.diff patch.
- * Remove kdevplatform version fix.
- * Update installed plugins. Some plugins were removed upstream.
- * Add Replaces against kdevelop and kdevelop-data (<< 4:3.9.96-1).
- Some files were move from these packages to kdevplatform1-libs.
+ * Add localization packages.
- -- Fathi Boudra Thu, 12 Nov 2009 15:29:14 +0100
+ -- Fathi Boudra Sat, 17 Apr 2010 10:33:53 +0300
-kdevplatform (0.9.96-0ubuntu3) lucid; urgency=low
+kdevplatform (0.10.0-1) unstable; urgency=low
- * The kdevplatform1-libs package replaces kdevelop-data (>> 4:3.9.96)
+ * New upstream release.
+ * Switch to dpkg-source 3.0 (quilt) format.
- -- Jonathan Thomas Thu, 05 Nov 2009 08:29:22 -0500
+ -- Fathi Boudra Sun, 04 Apr 2010 11:43:31 +0200
-kdevplatform (0.9.96-0ubuntu2) lucid; urgency=low
+kdevplatform (0.9.99-1) unstable; urgency=low
- * Fix .install files
+ * New upstream release.
- -- Jonathan Thomas Wed, 04 Nov 2009 14:02:57 -0500
+ -- Fathi Boudra Mon, 08 Mar 2010 14:27:31 +0100
-kdevplatform (0.9.96-0ubuntu1) lucid; urgency=low
+kdevplatform (0.9.98-1) unstable; urgency=low
- * Merge with Debian testing, remaining change:
- - Use a versioned boost build-dep
- * New upstream beta release:
- - Drop Debian's version-fixing patch, unneeded in the new beta
- - Update .install files
+ * New upstream release.
- -- Jonathan Thomas Wed, 04 Nov 2009 09:30:06 -0500
+ [ Fathi Boudra ]
+ * Update debian/control:
+ - bump build dependencies version (debhelper and pkg-kde-tools).
+ - bump Standards-Version to 3.8.4 (no changes needed).
+ * Update debian/kdevplatform1-libs.install file.
+ * Update debian/kdevplatform-dev.install file.
+ * Update debian/rules: pass -DCMAKE_SKIP_RPATH=ON
+ to workaround FindKDE4Internal.cmake default rpath value.
-kdevplatform (0.9.95-2) unstable; urgency=low
+ [ Modestas Vainius ]
+ * Fix Vcs-Browser URL.
- * Add patch to fix kdevplatform version.
+ -- Fathi Boudra Thu, 11 Feb 2010 16:48:26 +0100
- -- Fathi Boudra Mon, 24 Aug 2009 09:22:52 +0200
+kdevplatform (0.9.97-1) unstable; urgency=low
+
+ * New upstream release.
+ * Drop 01_kdevplatform_r1044088.diff patch.
+ * Update installed plugins: mercurial plugin removed.
-kdevplatform (0.9.95a-0ubuntu1) karmic; urgency=low
+ -- Fathi Boudra Sat, 12 Dec 2009 20:46:47 +0100
- * New upstream tarball
+kdevplatform (0.9.96-1) unstable; urgency=low
- -- Jonathan Thomas Sun, 23 Aug 2009 16:13:02 -0400
+ * New upstream release.
+ * Add 01_kdevplatform_r1044088.diff patch.
+ * Remove kdevplatform version fix.
+ * Update installed plugins. Some plugins were removed upstream.
+ * Add Replaces against kdevelop and kdevelop-data (<< 4:3.9.96-1).
+ Some files were move from these packages to kdevplatform1-libs.
+
+ -- Fathi Boudra Thu, 12 Nov 2009 15:29:14 +0100
-kdevplatform (0.9.95-0ubuntu1) karmic; urgency=low
+kdevplatform (0.9.95-2) unstable; urgency=low
- * New upstream release
- * Merge with Debian, remaining changes:
- - Keep versioned boost build-dep
- - Keep kdevplatform1-libs replaces: kdevplatform-data
+ * Add patch to fix kdevplatform version.
- -- Jonathan Thomas Sat, 22 Aug 2009 14:55:23 -0400
+ -- Fathi Boudra Mon, 24 Aug 2009 09:22:52 +0200
kdevplatform (0.9.95-1) unstable; urgency=low
@@ -110,15 +118,6 @@
-- Fathi Boudra Tue, 11 Aug 2009 15:50:12 +0200
-kdevplatform (0.9.94-1ubuntu1) karmic; urgency=low
-
- * Merge from debian unstable, remaining changes:
- - change libboost-serialization-dev which is a virtual package to
- libboost-serialization1.38-dev
- - kdevplatform1-libs replaces: kdevplatform-data
-
- -- Alessandro Ghersi Sun, 28 Jun 2009 20:18:07 +0200
-
kdevplatform (0.9.94-1) unstable; urgency=low
* New upstream release.
@@ -128,12 +127,6 @@
-- Fathi Boudra Mon, 15 Jun 2009 11:42:21 +0200
-kdevplatform (0.9.93-1ubuntu1) karmic; urgency=low
-
- * kdevplatform1-libs replaces: kdevplatform-data (LP: #380725)
-
- -- Jonathan Thomas Tue, 26 May 2009 16:24:10 -0400
-
kdevplatform (0.9.93-1) unstable; urgency=low
* New upstream release.
diff -Nru kdevplatform-0.9.98/debian/control kdevplatform-1.0.1/debian/control
--- kdevplatform-0.9.98/debian/control 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/control 2010-07-26 18:21:22.000000000 +0100
@@ -1,23 +1,23 @@
Source: kdevplatform
Section: libs
Priority: optional
-Maintainer: Ubuntu Developers
+Maintainer: Kubuntu Developers
XSBC-Original-Maintainer: Debian Qt/KDE Maintainers
Uploaders: Fathi Boudra , Jeremy Lainé
-Build-Depends: cdbs (>= 0.4.51), debhelper (>= 7.3.16), quilt, cmake (>= 2.6.2),
- pkg-kde-tools (>= 0.5), kdelibs5-dev (>= 4:4.3.3-0ubuntu4),
- libsvn-dev, libboost-serialization1.40-dev
+Build-Depends: cdbs (>= 0.4.51), debhelper (>= 7.4.15), quilt, cmake (>= 2.8.0),
+ pkg-kde-tools (>= 0.6.4), kdelibs5-dev (>= 4:4.4.1),
+ libsvn-dev, libboost-serialization-dev
# libcommoncpp2-dev, libboost-iostreams-dev
-Standards-Version: 3.8.3
+Standards-Version: 3.9.0
Homepage: http://www.kdevelop.org/
-Vcs-Browser: http://svn.debian.org/wsvn/pkg-kde/trunk/packages/kdevplatform
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-kde/trunk/packages/kdevplatform/#_trunk_packages_kdevplatform_
Vcs-Svn: svn://svn.debian.org/pkg-kde/trunk/packages/kdevplatform
Package: kdevplatform1-libs
-Section: libs
Architecture: any
Depends: ${shlibs:Depends}, libsublime1 (>= ${source:Version})
Replaces: kdevelop (<< 4:3.9.96-1), kdevelop-data (<< 4:3.9.96-1)
+Suggests: kdevplatform-l10n
Description: shared libraries for the KDevelop platform
This package contains shared libraries needed to run integrated development
environments based on the KDevelop platform.
@@ -48,9 +48,8 @@
This package is part of the KDevelop platform.
Package: libsublime1
-Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, kdelibs5 (>= 4:4.2.0)
+Depends: ${shlibs:Depends}
Description: an user interface library
sublime provides a user interface that supports multiple
mainwindows, multiple dockwidgets, split views and areas
@@ -66,3 +65,245 @@
libsublime.
.
This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-ca
+Section: localization
+Architecture: all
+Recommends: kde-l10n-ca
+Provides: kdevplatform-l10n
+Description: Catalan (ca) localization files for the KDevelop platform
+ This package contains the Catalan translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-cavalencia
+Section: localization
+Architecture: all
+Recommends: kde-l10n-cavalencia
+Provides: kdevplatform-l10n
+Description: Southern Catalan (Valencian) (ca@valencia) files for the KDevelop platform
+ This package contains the Southern Catalan (Valencian) translations for
+ applications using the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-da
+Section: localization
+Architecture: all
+Recommends: kde-l10n-da
+Provides: kdevplatform-l10n
+Description: Danish (da) localization files for the KDevelop platform
+ This package contains the Danish translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-de
+Section: localization
+Architecture: all
+Recommends: kde-l10n-de
+Provides: kdevplatform-l10n
+Description: German (de) localization files for the KDevelop platform
+ This package contains the German translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-engb
+Section: localization
+Architecture: all
+Recommends: kde-l10n-engb
+Provides: kdevplatform-l10n
+Description: British English (en_GB) localization files for the KDevelop platform
+ This package contains the British English translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-es
+Section: localization
+Architecture: all
+Recommends: kde-l10n-es
+Provides: kdevplatform-l10n
+Description: Spanish (es) localization files for the KDevelop platform
+ This package contains the Spanish translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-et
+Section: localization
+Architecture: all
+Recommends: kde-l10n-et
+Provides: kdevplatform-l10n
+Description: Estonian (et) localization files for the KDevelop platform
+ This package contains the Estonian translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-fi
+Section: localization
+Architecture: all
+Recommends: kde-l10n-fi
+Provides: kdevplatform-l10n
+Description: Finnish (fi) localization files for the KDevelop platform
+ This package contains the Finnish translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-fr
+Section: localization
+Architecture: all
+Recommends: kde-l10n-fr
+Provides: kdevplatform-l10n
+Description: French (fr) localization files for the KDevelop platform
+ This package contains the French translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-gl
+Section: localization
+Architecture: all
+Recommends: kde-l10n-gl
+Provides: kdevplatform-l10n
+Description: Galician (gl) localization files for the KDevelop platform
+ This package contains the Galician translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-it
+Section: localization
+Architecture: all
+Recommends: kde-l10n-it
+Provides: kdevplatform-l10n
+Description: Italian (it) localization files for the KDevelop platform
+ This package contains the Italian translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-nds
+Section: localization
+Architecture: all
+Recommends: kde-l10n-nds
+Provides: kdevplatform-l10n
+Description: Low Saxon (nds) localization files for the KDevelop platform
+ This package contains the Low Saxon translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-nl
+Section: localization
+Architecture: all
+Recommends: kde-l10n-nl
+Provides: kdevplatform-l10n
+Description: Dutch (nl) localization files for the KDevelop platform
+ This package contains the Dutch translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-pt
+Section: localization
+Architecture: all
+Recommends: kde-l10n-pt
+Provides: kdevplatform-l10n
+Description: Portugese (pt) localization files for the KDevelop platform
+ This package contains the Portugese translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-ptbr
+Section: localization
+Architecture: all
+Recommends: kde-l10n-ptbr
+Provides: kdevplatform-l10n
+Description: Brazilian Portugese (pt_BR) localization files for the KDevelop platform
+ This package contains the Brazilian Portugese translations for applications
+ using the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-sl
+Section: localization
+Architecture: all
+Recommends: kde-l10n-sl
+Provides: kdevplatform-l10n
+Description: Slovenian (sl) localization files for the KDevelop platform
+ This package contains the Slovenian translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-sv
+Section: localization
+Architecture: all
+Recommends: kde-l10n-sv
+Provides: kdevplatform-l10n
+Description: Swedish (sv) localization files for the KDevelop platform
+ This package contains the Swedish translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-th
+Section: localization
+Architecture: all
+Recommends: kde-l10n-th
+Provides: kdevplatform-l10n
+Description: Thai (th) localization files for the KDevelop platform
+ This package contains the Thai translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+# Package: kdevplatform-l10n-tr
+# Section: localization
+# Architecture: all
+# Recommends: kde-l10n-tr
+# Provides: kdevplatform-l10n
+# Description: Turkish (tr) localization files for the KDevelop platform
+# This package contains the Turkish translations for applications using
+# the KDevelop platform.
+# .
+# This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-uk
+Section: localization
+Architecture: all
+Recommends: kde-l10n-uk
+Provides: kdevplatform-l10n
+Description: Ukrainian (uk) localization files for the KDevelop platform
+ This package contains the Ukrainian translations for applications using
+ the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-zhcn
+Section: localization
+Architecture: all
+Recommends: kde-l10n-zhcn
+Provides: kdevplatform-l10n
+Description: Chinese Simplified (zh_CN) localization files for the KDevelop platform
+ This package contains the Chinese simplified translations for applications
+ using the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
+
+Package: kdevplatform-l10n-zhtw
+Section: localization
+Architecture: all
+Recommends: kde-l10n-zhtw
+Provides: kdevplatform-l10n
+Description: Chinese Traditional (zh_TW) localization files for the KDevelop platform
+ This package contains the Chinese Traditional translations for applications
+ using the KDevelop platform.
+ .
+ This package is part of the KDevelop platform.
diff -Nru kdevplatform-0.9.98/debian/copyright kdevplatform-1.0.1/debian/copyright
--- kdevplatform-0.9.98/debian/copyright 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/copyright 2010-03-09 11:44:34.000000000 +0000
@@ -18,7 +18,7 @@
Copyright:
- © 1999-2009 The KDevelop Platform developers
+ © 1999-2010 The KDevelop Platform developers
© 2006-2009 Andreas Pakulat
© 2003-2008 Hamish Rodda
@@ -107,6 +107,6 @@
The Debian packaging is:
- Copyright (C) 2009, Fathi Boudra
+ Copyright (C) 2009-2010, Fathi Boudra
and is licensed under the GPL, see above.
diff -Nru kdevplatform-0.9.98/debian/kdevplatform1-libs.install kdevplatform-1.0.1/debian/kdevplatform1-libs.install
--- kdevplatform-0.9.98/debian/kdevplatform1-libs.install 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform1-libs.install 2010-02-17 17:07:21.000000000 +0000
@@ -51,6 +51,7 @@
usr/share/kde4/apps/kdevproblemreporter/kdevproblemreporter.rc
usr/share/kde4/apps/kdevprojectmanagerview/kdevprojectmanagerview.rc
usr/share/kde4/apps/kdevquickopen/kdevquickopen.rc
+usr/share/kde4/apps/kdevsession/kdevsessionui.rc
usr/share/kde4/apps/kdevsnippet/kdevsnippet.rc
usr/share/kde4/apps/kdevsourceformatter/kdevsourceformatter.rc
usr/share/kde4/apps/kdevstandardoutputview/kdevstandardoutputview.rc
@@ -82,4 +83,3 @@
usr/share/kde4/services/kdevstandardoutputview.desktop
usr/share/kde4/services/kdevsubversion.desktop
usr/share/kde4/servicetypes/kdevelopplugin.desktop
-usr/share/kde4/apps/kdevsession/kdevsessionui.rc
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-dev.install kdevplatform-1.0.1/debian/kdevplatform-dev.install
--- kdevplatform-0.9.98/debian/kdevplatform-dev.install 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-dev.install 2010-02-17 17:07:21.000000000 +0000
@@ -9,7 +9,7 @@
usr/include/kdevplatform/tests
usr/include/kdevplatform/util
usr/include/kdevplatform/vcs
-usr/include/kdevplatform/genericprojectmanager/igenericprojectmanager.h
+usr/include/kdevplatform/genericprojectmanager
usr/lib/cmake/kdevplatform/KDevPlatformConfig.cmake
usr/lib/cmake/kdevplatform/KDevPlatformConfigVersion.cmake
usr/lib/cmake/kdevplatform/KDevPlatformMacros.cmake
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-ca.install kdevplatform-1.0.1/debian/kdevplatform-l10n-ca.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-ca.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-ca.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/ca
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-cavalencia.install kdevplatform-1.0.1/debian/kdevplatform-l10n-cavalencia.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-cavalencia.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-cavalencia.install 2010-04-17 13:44:34.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/ca@valencia
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-da.install kdevplatform-1.0.1/debian/kdevplatform-l10n-da.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-da.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-da.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/da
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-de.install kdevplatform-1.0.1/debian/kdevplatform-l10n-de.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-de.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-de.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/de
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-engb.install kdevplatform-1.0.1/debian/kdevplatform-l10n-engb.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-engb.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-engb.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/en_GB
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-es.install kdevplatform-1.0.1/debian/kdevplatform-l10n-es.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-es.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-es.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/es
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-et.install kdevplatform-1.0.1/debian/kdevplatform-l10n-et.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-et.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-et.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/et
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-fi.install kdevplatform-1.0.1/debian/kdevplatform-l10n-fi.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-fi.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-fi.install 2010-07-23 05:24:24.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/fi
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-fr.install kdevplatform-1.0.1/debian/kdevplatform-l10n-fr.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-fr.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-fr.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/fr
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-gl.install kdevplatform-1.0.1/debian/kdevplatform-l10n-gl.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-gl.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-gl.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/gl
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-it.install kdevplatform-1.0.1/debian/kdevplatform-l10n-it.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-it.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-it.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/it
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-nds.install kdevplatform-1.0.1/debian/kdevplatform-l10n-nds.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-nds.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-nds.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/nds
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-nl.install kdevplatform-1.0.1/debian/kdevplatform-l10n-nl.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-nl.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-nl.install 2010-07-23 05:24:30.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/nl
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-ptbr.install kdevplatform-1.0.1/debian/kdevplatform-l10n-ptbr.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-ptbr.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-ptbr.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/pt_BR
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-pt.install kdevplatform-1.0.1/debian/kdevplatform-l10n-pt.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-pt.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-pt.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/pt
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-sl.install kdevplatform-1.0.1/debian/kdevplatform-l10n-sl.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-sl.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-sl.install 2010-07-23 05:24:35.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/sl
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-sv.install kdevplatform-1.0.1/debian/kdevplatform-l10n-sv.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-sv.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-sv.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/sv
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-th.install kdevplatform-1.0.1/debian/kdevplatform-l10n-th.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-th.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-th.install 2010-07-23 05:24:42.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/th
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-tr.install kdevplatform-1.0.1/debian/kdevplatform-l10n-tr.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-tr.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-tr.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/tr
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-uk.install kdevplatform-1.0.1/debian/kdevplatform-l10n-uk.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-uk.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-uk.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/uk
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-zhcn.install kdevplatform-1.0.1/debian/kdevplatform-l10n-zhcn.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-zhcn.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-zhcn.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/zh_CN
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/kdevplatform-l10n-zhtw.install kdevplatform-1.0.1/debian/kdevplatform-l10n-zhtw.install
--- kdevplatform-0.9.98/debian/kdevplatform-l10n-zhtw.install 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/kdevplatform-l10n-zhtw.install 2010-04-17 11:38:39.000000000 +0100
@@ -0,0 +1 @@
+usr/share/locale/zh_TW
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/debian/patches/10_private_libs_soversion.diff kdevplatform-1.0.1/debian/patches/10_private_libs_soversion.diff
--- kdevplatform-0.9.98/debian/patches/10_private_libs_soversion.diff 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/patches/10_private_libs_soversion.diff 1970-01-01 01:00:00.000000000 +0100
@@ -1,42 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -24,6 +24,7 @@
-
- set(KDEVPLATFORM_LIB_VERSION 1.0.0)
- set(KDEVPLATFORM_LIB_SOVERSION 1)
-+set(PRIVATE_LIBS_SOVERSION ${KDevPlatform_VERSION_MAJOR}.${KDevPlatform_VERSION_MINOR}.${KDevPlatform_VERSION_PATCH})
-
- add_subdirectory(cmake)
- add_subdirectory(sublime)
---- a/plugins/teamwork/lib/libdiff2/CMakeLists.txt
-+++ b/plugins/teamwork/lib/libdiff2/CMakeLists.txt
-@@ -21,7 +21,6 @@
-
- # This library only exists as a convenience library for the teamwork plugin, thus it is not SOVERSION'ed
- kde4_add_library(kdevteamwork_diff2 SHARED ${diff2_PART_SRCS})
--
- target_link_libraries(kdevteamwork_diff2 ${KDE4_KDEUI_LIBS} ${KDE4_KDE3SUPPORT_LIBS} )
--
-+set_target_properties( kdevteamwork_diff2 PROPERTIES SOVERSION ${PRIVATE_LIBS_SOVERSION})
- install(TARGETS kdevteamwork_diff2 ${INSTALL_TARGETS_DEFAULT_ARGS})
---- a/plugins/teamwork/lib/dynamictext/CMakeLists.txt
-+++ b/plugins/teamwork/lib/dynamictext/CMakeLists.txt
-@@ -28,6 +28,7 @@
- # This library only exists as a convenience library for the teamwork plugin, thus it is not SOVERSION'ed
- ADD_LIBRARY( kdevteamwork_dynamictext SHARED ${dynamictext_SRCS} )
- TARGET_LINK_LIBRARIES( kdevteamwork_dynamictext ${COMMONCPP2_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SERIALIZATION_LIBRARY} ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
-+set_target_properties( kdevteamwork_dynamictext PROPERTIES SOVERSION ${PRIVATE_LIBS_SOVERSION})
- install(TARGETS kdevteamwork_dynamictext ${INSTALL_TARGETS_DEFAULT_ARGS})
-
- ADD_EXECUTABLE( testexec main.cpp)
---- a/plugins/teamwork/lib/network/CMakeLists.txt
-+++ b/plugins/teamwork/lib/network/CMakeLists.txt
-@@ -34,7 +34,7 @@
- # This library only exists as a convenience library for the teamwork plugin, thus it is not SOVERSION'ed
- ADD_LIBRARY( kdevteamwork_network SHARED ${libfiles} )
- TARGET_LINK_LIBRARIES( kdevteamwork_network ${COMMONCPP2_LIBRARIES} ${Boost_SERIALIZATION_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${QT_QTCORE_LIBRARY})
--
-+set_target_properties( kdevteamwork_network PROPERTIES SOVERSION ${PRIVATE_LIBS_SOVERSION})
- INSTALL(TARGETS kdevteamwork_network ${INSTALL_TARGETS_DEFAULT_ARGS})
-
- ###### Next Target ##########
diff -Nru kdevplatform-0.9.98/debian/patches/11_disable_examples_tests.diff kdevplatform-1.0.1/debian/patches/11_disable_examples_tests.diff
--- kdevplatform-0.9.98/debian/patches/11_disable_examples_tests.diff 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/patches/11_disable_examples_tests.diff 2010-04-05 11:38:19.000000000 +0100
@@ -1,3 +1,5 @@
+Description: disable examples and tests.
+
--- a/sublime/CMakeLists.txt
+++ b/sublime/CMakeLists.txt
@@ -1,6 +1,4 @@
diff -Nru kdevplatform-0.9.98/debian/patches/series kdevplatform-1.0.1/debian/patches/series
--- kdevplatform-0.9.98/debian/patches/series 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/patches/series 2010-02-17 20:15:17.000000000 +0000
@@ -1,2 +1 @@
-#10_private_libs_soversion.diff
11_disable_examples_tests.diff
diff -Nru kdevplatform-0.9.98/debian/README.source kdevplatform-1.0.1/debian/README.source
--- kdevplatform-0.9.98/debian/README.source 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/README.source 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-This package uses quilt for upstream source code patch management. Please read
-/usr/share/doc/quilt/README.source for more information how to apply, unapply,
-add, modify or remove patches.
-
-Please note that /usr/share/doc/quilt/README.source is only available in quilt
-version 0.46-4.1 or later.
diff -Nru kdevplatform-0.9.98/debian/rules kdevplatform-1.0.1/debian/rules
--- kdevplatform-0.9.98/debian/rules 2010-08-11 08:00:44.000000000 +0100
+++ kdevplatform-1.0.1/debian/rules 2010-07-26 18:20:48.000000000 +0100
@@ -1,5 +1,7 @@
#!/usr/bin/make -f
+export KUBUNTU_DESKTOP_POT=extragear-sdk_kdevplatform
+
include /usr/share/pkg-kde-tools/qt-kde-team/1/debian-qt-kde.mk
DEB_DBG_PACKAGE_kdevplatform1-libs := kdevplatform-dbg
diff -Nru kdevplatform-0.9.98/debian/source/format kdevplatform-1.0.1/debian/source/format
--- kdevplatform-0.9.98/debian/source/format 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/debian/source/format 2010-08-11 08:00:46.000000000 +0100
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru kdevplatform-0.9.98/debugger/framestack/framestackwidget.cpp kdevplatform-1.0.1/debugger/framestack/framestackwidget.cpp
--- kdevplatform-0.9.98/debugger/framestack/framestackwidget.cpp 2009-11-25 03:32:49.000000000 +0000
+++ kdevplatform-1.0.1/debugger/framestack/framestackwidget.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -30,7 +30,10 @@
#include
#include
#include
+#include
+#include
+#include
#include
#include
#include
@@ -40,6 +43,8 @@
#include "../../interfaces/idebugcontroller.h"
#include "../../interfaces/idocumentcontroller.h"
#include "framestackmodel.h"
+#include
+#include
namespace KDevelop {
@@ -64,6 +69,26 @@
m_threads = new QListView(m_threadsWidget);
m_frames = new QTreeView(this);
m_frames->setRootIsDecorated(false);
+ m_frames->setSelectionMode(QAbstractItemView::ContiguousSelection);
+ m_frames->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_frames->setAllColumnsShowFocus(true);
+ m_frames->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ m_framesContextMenu = new QMenu(m_frames);
+
+ KAction *selectAllAction = KStandardAction::selectAll(m_frames);
+ selectAllAction->setShortcut(KShortcut()); //FIXME: why does CTRL-A conflict with Katepart (while CTRL-Cbelow doesn't) ?
+ selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ connect(selectAllAction, SIGNAL(triggered()), SLOT(selectAll()));
+ m_framesContextMenu->addAction(selectAllAction);
+
+ KAction *copyAction = KStandardAction::copy(m_frames);
+ copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ connect(copyAction, SIGNAL(triggered()), SLOT(copySelection()));
+ m_framesContextMenu->addAction(copyAction);
+ addAction(copyAction);
+
+ connect(m_frames, SIGNAL(customContextMenuRequested(QPoint)), SLOT(frameContextMenuRequested(QPoint)));
m_threadsWidget->setLayout(new QVBoxLayout());
m_threadsWidget->layout()->addWidget(new QLabel(i18n("Threads:")));
@@ -168,13 +193,35 @@
IFrameStackModel::FrameItem f = m_session->frameStackModel()->frame(idx);
/* If line is -1, then it's not a source file at all. */
if (f.line != -1) {
- KUrl url = m_session->convertToLocalUrl(f.file);
- ICore::self()->documentController()->openDocument(url, KTextEditor::Cursor(f.line, 0));
+ QPair file = m_session->convertToLocalUrl(qMakePair(f.file, f.line));
+ ICore::self()->documentController()->openDocument(file.first, KTextEditor::Cursor(file.second, 0));
}
m_session->frameStackModel()->setCurrentFrame(f.nr);
}
+void FramestackWidget::frameContextMenuRequested(const QPoint& pos)
+{
+ m_framesContextMenu->popup( m_frames->mapToGlobal(pos) + QPoint(0, m_frames->header()->height()) );
+}
+
+void FramestackWidget::copySelection()
+{
+ QClipboard *cb = QApplication::clipboard();
+ QModelIndexList indexes = m_frames->selectionModel()->selectedRows();
+ QString content;
+ Q_FOREACH( QModelIndex index, indexes) {
+ IFrameStackModel::FrameItem frame = m_session->frameStackModel()->frame(index);
+ content += QString("#%1 %2() at %3:%4\n").arg(frame.nr).arg(frame.name).arg(frame.file.pathOrUrl(KUrl::RemoveTrailingSlash)).arg(frame.line);
+ }
+ cb->setText(content);
+}
+
+void FramestackWidget::selectAll()
+{
+ m_frames->selectAll();
+}
+
}
#include "framestackwidget.moc"
diff -Nru kdevplatform-0.9.98/debugger/framestack/framestackwidget.h kdevplatform-1.0.1/debugger/framestack/framestackwidget.h
--- kdevplatform-0.9.98/debugger/framestack/framestackwidget.h 2009-09-13 13:38:55.000000000 +0100
+++ kdevplatform-1.0.1/debugger/framestack/framestackwidget.h 2010-07-17 19:58:27.000000000 +0100
@@ -28,6 +28,7 @@
#include "../debuggerexport.h"
+class QMenu;
class QTreeView;
class QModelIndex;
class QListView;
@@ -55,12 +56,16 @@
void currentThreadChanged(int);
void currentFrameChanged(int);
void frameClicked(const QModelIndex& idx);
+ void frameContextMenuRequested(const QPoint &pos);
+ void copySelection();
+ void selectAll();
private:
IDebugSession *m_session;
QListView *m_threads;
QWidget *m_threadsWidget;
QTreeView *m_frames;
+ QMenu *m_framesContextMenu;
};
}
diff -Nru kdevplatform-0.9.98/debugger/interfaces/idebugsession.cpp kdevplatform-1.0.1/debugger/interfaces/idebugsession.cpp
--- kdevplatform-0.9.98/debugger/interfaces/idebugsession.cpp 2009-10-28 19:01:53.000000000 +0000
+++ kdevplatform-1.0.1/debugger/interfaces/idebugsession.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -77,12 +77,12 @@
emit event(e);
}
-KUrl IDebugSession::convertToLocalUrl(const KUrl &remoteUrl) const
+QPair IDebugSession::convertToLocalUrl(const QPair &remoteUrl) const
{
return remoteUrl;
}
-KUrl IDebugSession::convertToRemoteUrl(const KUrl& localUrl) const
+QPair IDebugSession::convertToRemoteUrl(const QPair& localUrl) const
{
return localUrl;
}
diff -Nru kdevplatform-0.9.98/debugger/interfaces/idebugsession.h kdevplatform-1.0.1/debugger/interfaces/idebugsession.h
--- kdevplatform-0.9.98/debugger/interfaces/idebugsession.h 2009-10-28 19:01:53.000000000 +0000
+++ kdevplatform-1.0.1/debugger/interfaces/idebugsession.h 2010-07-17 19:58:27.000000000 +0100
@@ -95,7 +95,7 @@
* The default implementation just returns the url and is sufficient for
* local debuggers. Remote debuggers can implement a path mapping mechanism.
*/
- virtual KUrl convertToLocalUrl(const KUrl &remoteUrl) const;
+ virtual QPair convertToLocalUrl(const QPair &remoteUrl) const;
/**
* Returns the remote Url for a source file used in the current debug session.
@@ -103,7 +103,7 @@
* The default implementation just returns the url and is sufficient for
* local debuggers. Remote debuggers can implement a path mapping mechanism.
*/
- virtual KUrl convertToRemoteUrl(const KUrl &localUrl) const;
+ virtual QPair convertToRemoteUrl(const QPair &localUrl) const;
IBreakpointController *breakpointController() const;
IVariableController *variableController() const;
diff -Nru kdevplatform-0.9.98/debugger/interfaces/ivariablecontroller.cpp kdevplatform-1.0.1/debugger/interfaces/ivariablecontroller.cpp
--- kdevplatform-0.9.98/debugger/interfaces/ivariablecontroller.cpp 2010-01-31 19:34:54.000000000 +0000
+++ kdevplatform-1.0.1/debugger/interfaces/ivariablecontroller.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -38,6 +38,7 @@
VariableCollection* IVariableController::variableCollection()
{
+ if (!ICore::self()) return 0;
return ICore::self()->debugController()->variableCollection();
}
@@ -80,6 +81,8 @@
void IVariableController::handleEvent(IDebugSession::event_t event)
{
+ if (!variableCollection()) return;
+
switch (event) {
case IDebugSession::program_state_changed:
case IDebugSession::thread_or_frame_changed:
diff -Nru kdevplatform-0.9.98/debugger/util/pathmappings.cpp kdevplatform-1.0.1/debugger/util/pathmappings.cpp
--- kdevplatform-0.9.98/debugger/util/pathmappings.cpp 2009-12-05 08:55:07.000000000 +0000
+++ kdevplatform-1.0.1/debugger/util/pathmappings.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -54,6 +54,7 @@
KUrl remote = pCfg.readEntry(pathMappingRemoteEntry, KUrl());
KUrl local = pCfg.readEntry(pathMappingLocalEntry, KUrl());
kDebug() << remote << local;
+ kDebug() << remoteUrl.pathOrUrl() << remote.pathOrUrl();
if (remoteUrl.pathOrUrl().startsWith(remote.pathOrUrl())) {
QString path = remoteUrl.pathOrUrl().mid(remote.pathOrUrl().length());
local.addPath(path);
@@ -75,6 +76,7 @@
KUrl remote = pCfg.readEntry(pathMappingRemoteEntry, KUrl());
KUrl local = pCfg.readEntry(pathMappingLocalEntry, KUrl());
kDebug() << remote << local;
+ kDebug() << localUrl.pathOrUrl() << local.pathOrUrl();
if (localUrl.pathOrUrl().startsWith(local.pathOrUrl())) {
QString path = localUrl.pathOrUrl().mid(local.pathOrUrl().length());
remote.addPath(path);
diff -Nru kdevplatform-0.9.98/debugger/variable/variabletooltip.cpp kdevplatform-1.0.1/debugger/variable/variabletooltip.cpp
--- kdevplatform-0.9.98/debugger/variable/variabletooltip.cpp 2009-09-05 10:16:04.000000000 +0100
+++ kdevplatform-1.0.1/debugger/variable/variabletooltip.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include "variablecollection.h"
#include "../breakpoint/breakpointmodel.h"
@@ -45,11 +46,56 @@
namespace KDevelop {
+class SizeGrip : public QWidget
+{
+public:
+ SizeGrip(QWidget* parent) : QWidget(parent) {
+ m_parent = parent;
+ }
+protected:
+ virtual void paintEvent(QPaintEvent *)
+ {
+ QPainter painter(this);
+ QStyleOptionSizeGrip opt;
+ opt.init(this);
+ opt.corner = Qt::BottomRightCorner;
+ style()->drawControl(QStyle::CE_SizeGrip, &opt, &painter, this);
+ }
+
+ virtual void mousePressEvent(QMouseEvent* e)
+ {
+ if (e->button() == Qt::LeftButton) {
+ m_pos = e->globalPos();
+ m_startSize = m_parent->size();
+ e->ignore();
+ }
+ }
+ virtual void mouseReleaseEvent(QMouseEvent*)
+ {
+ m_pos = QPoint();
+ }
+ virtual void mouseMoveEvent(QMouseEvent* e)
+ {
+ if (!m_pos.isNull()) {
+ m_parent->resize(
+ m_startSize.width() + (e->globalPos().x() - m_pos.x()),
+ m_startSize.height() + (e->globalPos().y() - m_pos.y())
+ );
+ }
+ }
+private:
+ QWidget *m_parent;
+ QSize m_startSize;
+ QPoint m_pos;
+};
+
VariableToolTip::VariableToolTip(QWidget* parent, QPoint position,
const QString& identifier)
-: ActiveToolTip(parent, position)
+: ActiveToolTip(parent, position)
{
- model_ = new TreeModel(QVector() << "Name" << "Type",
+ setPalette( QApplication::palette() );
+
+ model_ = new TreeModel(QVector() << i18n("Name") << i18n("Value"),
this);
TooltipRoot* tr = new TooltipRoot(model_);
@@ -63,9 +109,8 @@
QVBoxLayout* l = new QVBoxLayout(this);
l->setContentsMargins(0, 0, 0, 0);
view_ = new AsyncTreeView(model_, this);
- view_->header()->resizeSection(0, 200);
+ view_->header()->resizeSection(0, 150);
view_->header()->resizeSection(1, 90);
- view_->header()->hide();
view_->setSelectionBehavior(QAbstractItemView::SelectRows);
view_->setSelectionMode(QAbstractItemView::SingleSelection);
view_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -82,20 +127,28 @@
QItemSelectionModel::Rows
| QItemSelectionModel::ClearAndSelect);
- QHBoxLayout* inner = new QHBoxLayout();
- inner->setContentsMargins(11, 0, 11, 6);
- l->addLayout(inner);
- QLabel* label = new QLabel(i18n("Watch this"), this);
- inner->addWidget(label);
- QLabel* label2 = new QLabel(i18n("Stop on change"),
+ QHBoxLayout* labelL = new QHBoxLayout();
+ labelL->setContentsMargins(11, 0, 11, 6);
+ QLabel* label = new QLabel(i18n("Watch this"), this);
+ labelL->addWidget(label);
+ QLabel* label2 = new QLabel(i18n("Stop on change"),
this);
- inner->addWidget(label2);
+ labelL->addWidget(label2);
connect(label, SIGNAL(linkActivated(const QString&)),
this, SLOT(slotLinkActivated(const QString&)));
connect(label2, SIGNAL(linkActivated(const QString&)),
this, SLOT(slotLinkActivated(const QString&)));
-
+ QHBoxLayout* inner = new QHBoxLayout();
+ l->addLayout(inner);
+ inner->setContentsMargins(0, 0, 0, 0);
+ inner->addLayout(labelL);
+ inner->addStretch();
+
+ SizeGrip* g = new SizeGrip(this);
+ g->setFixedSize(16, 16);
+ inner->addWidget(g, 0, (Qt::Alignment)(Qt::AlignRight | Qt::AlignBottom));
+
move(position);
resize(310, 100);
}
diff -Nru kdevplatform-0.9.98/.gitignore kdevplatform-1.0.1/.gitignore
--- kdevplatform-0.9.98/.gitignore 2008-10-29 19:01:06.000000000 +0000
+++ kdevplatform-1.0.1/.gitignore 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-apidocs
-.kdev4
-doxygen.log
-
diff -Nru kdevplatform-0.9.98/INSTALL kdevplatform-1.0.1/INSTALL
--- kdevplatform-0.9.98/INSTALL 2007-08-03 04:27:58.000000000 +0100
+++ kdevplatform-1.0.1/INSTALL 2010-07-17 19:58:27.000000000 +0100
@@ -17,3 +17,5 @@
And to install run:
make install
+
+Please also see: http://www.kdevelop.org/mediawiki/index.php/KDevelop_4/compiling
diff -Nru kdevplatform-0.9.98/interfaces/contextmenuextension.h kdevplatform-1.0.1/interfaces/contextmenuextension.h
--- kdevplatform-0.9.98/interfaces/contextmenuextension.h 2010-01-15 15:51:11.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/contextmenuextension.h 2010-07-17 19:58:27.000000000 +0100
@@ -51,10 +51,7 @@
static const QString DebugGroup;
/** menu group to contain editing actions */
static const QString EditGroup;
- /** menu group to contain version control actions
- * Note that this group will automatically be
- * populated with a few standard VCS actions by the
- * vcscommon plugin. */
+ /** menu group to contain version control actions */
static const QString VcsGroup;
/** menu group to contain project actions */
static const QString ProjectGroup;
diff -Nru kdevplatform-0.9.98/interfaces/icore.h kdevplatform-1.0.1/interfaces/icore.h
--- kdevplatform-0.9.98/interfaces/icore.h 2010-01-17 00:07:17.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/icore.h 2010-07-17 19:58:27.000000000 +0100
@@ -121,6 +121,10 @@
/** @return true if the application is currently being shut down */
virtual bool shuttingDown() const = 0;
+ Q_SIGNALS:
+ /** Emitted when the initialization of the core components has been completed */
+ void initializationCompleted();
+
protected:
ICore(QObject *parent = 0);
static ICore *m_self;
diff -Nru kdevplatform-0.9.98/interfaces/idocumentcontroller.h kdevplatform-1.0.1/interfaces/idocumentcontroller.h
--- kdevplatform-0.9.98/interfaces/idocumentcontroller.h 2009-12-17 22:33:05.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/idocumentcontroller.h 2010-07-17 19:58:27.000000000 +0100
@@ -89,6 +89,8 @@
virtual void notifyDocumentClosed(IDocument* doc) = 0;
virtual IDocumentFactory* factory(const QString& mime) const = 0;
+
+ Q_SCRIPTABLE virtual KTextEditor::Document* globalTextEditorInstance()=0;
public Q_SLOTS:
/**Opens a new or existing document.
@param url The full Url of the document to open.
diff -Nru kdevplatform-0.9.98/interfaces/ipartcontroller.cpp kdevplatform-1.0.1/interfaces/ipartcontroller.cpp
--- kdevplatform-0.9.98/interfaces/ipartcontroller.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/interfaces/ipartcontroller.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -61,10 +61,8 @@
{
ptr = offers.first();
}
- KParts::Factory *factory = static_cast (
- KLibLoader::self()->factory(
- QFile::encodeName( ptr->library() ) ) );
- return factory;
+ KPluginLoader loader( QFile::encodeName( ptr->library() ) );
+ return static_cast( loader.factory() );
}
return 0;
diff -Nru kdevplatform-0.9.98/interfaces/ipatchsource.cpp kdevplatform-1.0.1/interfaces/ipatchsource.cpp
--- kdevplatform-0.9.98/interfaces/ipatchsource.cpp 2009-09-13 23:14:25.000000000 +0100
+++ kdevplatform-1.0.1/interfaces/ipatchsource.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -1,4 +1,6 @@
/*
+ Copyright 2006 David Nolden
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
@@ -37,6 +39,7 @@
bool IPatchSource::finishReview(QList< KUrl > selection)
{
+ Q_UNUSED(selection);
return true;
}
diff -Nru kdevplatform-0.9.98/interfaces/ipatchsource.h kdevplatform-1.0.1/interfaces/ipatchsource.h
--- kdevplatform-0.9.98/interfaces/ipatchsource.h 2009-11-03 00:06:03.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/ipatchsource.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,4 +1,6 @@
/*
+ Copyright 2006 David Nolden
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
@@ -25,19 +27,24 @@
namespace KDevelop {
-///Any entity may delete an IPatchSource based object at will, so it must always be referenced through a QPointer.
+///Any entity may delete an IPatchSource based object at will, so it must always be referenced through a QPointer (Just use IPatchSource::Ptr).
class KDEVPLATFORMINTERFACES_EXPORT IPatchSource : public QObject {
Q_OBJECT
public:
typedef QPointer Ptr;
- ///Name of the patch, that will be shown in a combo box. Should describe the patch in a useful way, for example "Difference to base in kdevplatform/language"
+ ///Name of the patch, that will be shown in a combo box. Should
+ ///describe the patch in a useful way, for example "Difference to base in kdevplatform/language"
virtual QString name() const = 0;
///Icon that will be shown with the patch
virtual QIcon icon() const;
- ///Explicit updating of the patch: If it is a dynamic patch, it should re-compare the files or whatever needs to be done
+ ///Should tell if the patch is already applied on the local version.
+ virtual bool isAlreadyApplied() const = 0;
+
+ ///Explicit updating of the patch: If it is a dynamic patch, it
+ ///should re-compare the files or whatever needs to be done
///If the patch has changed, patchChanged needs to be emitted
virtual void update() = 0;
@@ -69,8 +76,8 @@
virtual bool canCancel() const;
///Should return whether the user should be able to select files of the patch
- ///The files available for selection will be all files affected by the patch, and the files return by additionalSelectableFiles()
- ///The default implementation returns false
+ ///The files available for selection will be all files affected by the patch, and the files
+ ///return by additionalSelectableFiles() The default implementation returns false
virtual bool canSelectFiles() const;
///May return an additional list of selectable files together with short description strings for this patch
diff -Nru kdevplatform-0.9.98/interfaces/iplugincontroller.h kdevplatform-1.0.1/interfaces/iplugincontroller.h
--- kdevplatform-0.9.98/interfaces/iplugincontroller.h 2009-10-18 14:36:35.000000000 +0100
+++ kdevplatform-1.0.1/interfaces/iplugincontroller.h 2010-07-17 19:58:27.000000000 +0100
@@ -45,6 +45,22 @@
* The KDevelop plugin controller.
* The Plugin controller is responsible for querying, loading and unloading
* available plugins.
+ *
+ * Most of the time if you want to get at a plugin you should be using
+ * extensionForPlugin with the extension interface name. If you need to get at
+ * the actual \c IPlugin* pointer to connect signals/slots you should use
+ * \c pluginForExtension() and then the IPlugin's extension member function to get
+ * at the extension interface if necessary.
+ *
+ * If you have the need to load a specific plugin for a given extension both
+ * functions have an optional second parameter that allows to specify the name
+ * of the plugin as declared in the \c .desktop file under the
+ * \c X-KDE-PluginInfo-Name property. This should be used only very seldomly in
+ * real code and is mostly meant for testing and for implementation in the
+ * shell as it makes the code dependent on the pluginname which may change and
+ * also the actual plugin implementation so users cannot exchange one plugin
+ * with another also implementing the same interface.
+ *
*/
class KDEVPLATFORMINTERFACES_EXPORT IPluginController : public QObject
{
diff -Nru kdevplatform-0.9.98/interfaces/iplugin.h kdevplatform-1.0.1/interfaces/iplugin.h
--- kdevplatform-0.9.98/interfaces/iplugin.h 2009-12-17 00:19:19.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/iplugin.h 2010-07-17 19:58:27.000000000 +0100
@@ -43,7 +43,7 @@
* to make sure old source (or binary) incompatible plugins are not loaded.
* Increase this if it is necessary that old plugins stop working.
*/
-#define KDEVELOP_PLUGIN_VERSION 8
+#define KDEVELOP_PLUGIN_VERSION 9
/**
* This macro adds an extension interface to register with the extension manager
@@ -68,54 +68,62 @@
* description. The .desktop file template looks like:
* @code
* [Desktop Entry]
- * Encoding=UTF-8
* Type=Service
+ * Exec=blubb
* Name=
* GenericName=
* Comment=
* Icon=
- * X-KDevelop-Plugin-Version=
- * X-KDevelop-Plugin-Homepage=
- * X-KDevelop-Plugin-BugsEmailAddress=
- * X-KDevelop-Plugin-Copyright=
+ * ServiceTypes=KDevelop/Plugin
* X-KDE-Library=
+ * X-KDE-PluginInfo-Name=
+ * X-KDE-PluginInfo-Author=
+ * X-KDE-PluginInfo-Version=
+ * X-KDE-PluginInfo-License=
* X-KDevelop-Version=
* X-KDevelop-Category=
- * X-KDevelop-Properties=
- * X-KDevelop-Args=
+ * X-KDevelop-Mode=GUI
+ * X-KDevelop-LoadMode=
+ * X-KDevelop-Language=
+ * X-KDevelop-SupportedMimeTypes=
+ * X-KDevelop-Interfaces=
+ * X-KDevelop-IOptional=
+ * X-KDevelop-IRequired=
* @endcode
* Description of parameters in .desktop file:
- * - Name is a non-translatable name of a plugin, it is used in KTrader
- * queries to search for a plugin (required);
- * - GenericName is a translatable name of a plugin, it is used to show
- * plugin names in GUI (required);
+ * - Name is a translatable name of a plugin, it is used in the plugin
+ * selection list (required);
+ * - GenericName is a translatable generic name of a plugin, it should
+ * describe in general what the plugin can do (required);
* - Comment is a short description about the plugin (optional);
* - Icon is a plugin icon (preferred);
- * - X-KDevelop-Plugin-Version is a version of a plugin (optional);
+ * X-KDE-librarythis is the name of the .so file to load for this plugin (required);
+ * - X-KDE-PluginInfo-Name is a non-translateable user-readable plugin
+ * identifier used in KTrader queries (required);
+ * - X-KDE-PluginInfo-Author is a non-translateable name of the plugin
+ * author (optional);
+ * - X-KDE-PluginInfo-Version is version number of the plugin (optional);
+ * - X-KDE-PluginInfo-License is a license (optional). can be: GPL,
+ * LGPL, BSD, Artistic, QPL or Custom. If this property is not set, license is
+ * considered as unknown;
+ * - X-KDevelop-Plugin-Version is the KDevPlatform API version this plugin
+ * works with (required);
* - X-KDevelop-Interfaces is a list of extension interfaces that this
* plugin implements (optional);
* - X-KDevelop-IRequired is a list of extension interfaces that this
* plugin depends on (optional);
* - X-KDevelop-IOptional is a list of extension interfaces that this
* plugin will use if they are available (optional);
- * - X-KDevelop-Plugin-Homepage is a home page of a plugin (optional);
- * - X-KDevelop-Plugin-License is a license (optional). can be: GPL,
- * LGPL, BSD, Artistic, QPL or Custom. If this property is not set, license is
- * considered as unknown;
- * - X-KDevelop-Plugin-BugsEmailAddress is an email address for bug
- * reports (optional);
- * - X-KDevelop-Plugin-Copyright is a copyright statement (optional);
- * - X-KDE-Library is a name of library which contains the plugin
- * (required);
- * - X-KDevelop-Version is a version of KDevelop interfaces which is
- * supported by the plugin (required);
+ * - X-KDevelop-Language is the name of the language the plugin provides
+ * support for (optional);
+ * - X-KDevelop-SupportedMimeTypes is a list of mimetypes that the
+ * language-parser in this plugin supports (optional);
+ * - X-KDevelop-Mode is either GUI or NoGUI to indicate wether a plugin can run
+ * with the GUI components loaded or not (required);
* - X-KDevelop-Category is a scope of a plugin (see below for
* explanation) (required);
- * - X-KDevelop-Args is a list of additional arguments passed to plugins
- * constructor (optional);
- * - X-KDevelop-Properties is a list of properties which this plugin
- * supports, see the Profile documentation for an explanation (required to work
- * with shells that support profiles).
+ * - X-KDevelop-LoadMode can be set to AlwaysOn in which case the plugin will
+ * never be unloaded even if requested via the API. (optional);
*
* Plugin scope can be either:
* - Global
diff -Nru kdevplatform-0.9.98/interfaces/iprojectcontroller.h kdevplatform-1.0.1/interfaces/iprojectcontroller.h
--- kdevplatform-0.9.98/interfaces/iprojectcontroller.h 2009-11-01 22:21:22.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/iprojectcontroller.h 2010-07-17 19:58:27.000000000 +0100
@@ -57,14 +57,6 @@
Q_SCRIPTABLE virtual ProjectModel* projectModel() = 0;
Q_SCRIPTABLE virtual ProjectBuildSetModel* buildSetModel() = 0;
-
- /**
- * Provides access to the selection model of the project view.
- * This way it is possible to fetch the list of selected items in
- * the project view and use that to prefill some thing.
- * @returns the selection model
- */
- Q_SCRIPTABLE virtual QItemSelectionModel* projectSelectionModel() = 0;
/**
* Find an open project using the name of the project
diff -Nru kdevplatform-0.9.98/interfaces/iproject.h kdevplatform-1.0.1/interfaces/iproject.h
--- kdevplatform-0.9.98/interfaces/iproject.h 2009-11-08 15:43:00.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/iproject.h 2010-07-17 19:58:27.000000000 +0100
@@ -46,6 +46,7 @@
class IPlugin;
class IProjectFileManager;
class IBuildSystemManager;
+class ProjectBaseItem;
class ProjectFileItem;
class ProjectFolderItem;
class IndexedString;
@@ -111,10 +112,13 @@
/** Get a list of all files in the project */
Q_SCRIPTABLE virtual QList files() const = 0;
- /** Get all items corresponding to the @p file url */
+ /** Get all items corresponding to the @p folder url */
+ Q_SCRIPTABLE virtual QList itemsForUrl( const KUrl& url ) const = 0;
+
+ /** Get all file items corresponding to the @p file url */
Q_SCRIPTABLE virtual QList filesForUrl( const KUrl& file ) const = 0;
- /** Get all items corresponding to the @p folder url */
+ /** Get all folder items corresponding to the @p folder url */
Q_SCRIPTABLE virtual QList foldersForUrl( const KUrl& folder ) const = 0;
/** Make the model to reload */
@@ -130,6 +134,10 @@
virtual void removeFromFileSet( const IndexedString& ) = 0;
virtual QSet fileSet() const = 0;
+ /** Returns whether the project is ready to be used or not.
+ A project won't be ready for use when it's being reloaded or still loading
+ */
+ virtual bool isReady() const=0;
// virtual void setLocalFile( const KUrl& ) = 0;
// virtual void setGlobalFile( const KUrl& ) = 0;
diff -Nru kdevplatform-0.9.98/interfaces/iruncontroller.h kdevplatform-1.0.1/interfaces/iruncontroller.h
--- kdevplatform-0.9.98/interfaces/iruncontroller.h 2009-10-31 19:07:20.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/iruncontroller.h 2010-07-17 19:58:27.000000000 +0100
@@ -26,6 +26,8 @@
#include "interfacesexport.h"
+class KJob;
+
namespace KDevelop
{
class IProject;
@@ -62,7 +64,12 @@
* @returns a list of registered launch modes
*/
virtual QList launchModes() const = 0;
-
+
+ /**
+ * Get a list of all available launch configurations
+ */
+ virtual QList launchConfigurations() const = 0;
+
/**
* Get a specific launch mode based using its \a id
* @param id the identifier of the launchmode to get
@@ -106,7 +113,9 @@
* @param runMode the launch mode to start with
*/
virtual void executeDefaultLaunch( const QString& runMode ) = 0;
-
+
+ virtual KJob* execute(const QString& launchMode, ILaunchConfiguration* launch) = 0;
+
/**
* tries to find a launch config type for the given @p id
* @param id the id of the launch configuration type to search
diff -Nru kdevplatform-0.9.98/interfaces/isession.h kdevplatform-1.0.1/interfaces/isession.h
--- kdevplatform-0.9.98/interfaces/isession.h 2009-12-08 14:54:00.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/isession.h 2010-07-17 19:58:27.000000000 +0100
@@ -26,6 +26,7 @@
#include
#include
+struct QUuid;
class QString;
class KUrl;
@@ -54,6 +55,7 @@
virtual KUrl::List containedProjects() const = 0;
virtual KUrl pluginDataArea( const IPlugin* ) = 0;
virtual KSharedConfig::Ptr config() = 0;
+ virtual QUuid id() const = 0;
};
}
diff -Nru kdevplatform-0.9.98/interfaces/isourceformattercontroller.h kdevplatform-1.0.1/interfaces/isourceformattercontroller.h
--- kdevplatform-0.9.98/interfaces/isourceformattercontroller.h 2009-12-27 16:25:48.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/isourceformattercontroller.h 2010-07-17 19:58:27.000000000 +0100
@@ -28,6 +28,7 @@
namespace KDevelop
{
class ISourceFormatter;
+class SourceFormatterStyle;
/** \short An interface to the controller managing all source formatter plugins
*/
@@ -51,6 +52,8 @@
/** \return Whether this mime type is supported by any plugin.
*/
virtual bool isMimeTypeSupported(const KMimeType::Ptr &mime) = 0;
+
+ virtual KDevelop::SourceFormatterStyle styleForMimeType( const KMimeType::Ptr& mime ) = 0;
};
}
diff -Nru kdevplatform-0.9.98/interfaces/isourceformatter.h kdevplatform-1.0.1/interfaces/isourceformatter.h
--- kdevplatform-0.9.98/interfaces/isourceformatter.h 2009-12-27 16:25:48.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/isourceformatter.h 2010-07-17 19:58:27.000000000 +0100
@@ -32,7 +32,7 @@
class KDEVPLATFORMINTERFACES_EXPORT SourceFormatterStyle
{
public:
- SourceFormatterStyle() {};
+ SourceFormatterStyle() {};
SourceFormatterStyle( const QString& name ) : m_name(name) {}
void setContent( const QString& content ) { m_content = content; }
void setCaption( const QString& caption ) { m_caption = caption; }
@@ -125,17 +125,21 @@
*/
virtual QString formatSource(const QString &text, const KMimeType::Ptr &mime, const QString& leftContext = QString(), const QString& rightContext = QString()) = 0;
+ /**
+ * Format with the given style, this is mostly for the kcm to format the preview text
+ * Its a bit of a hassle that this needs to be public API, but I can't find a better way
+ * to do this.
+ */
+ virtual QString formatSourceWithStyle( SourceFormatterStyle,
+ const QString& text,
+ const KMimeType::Ptr &mime,
+ const QString& leftContext = QString(),
+ const QString& rightContext = QString() ) = 0;
+
/** \return A map of predefined styles (a key and a caption for each type)
*/
virtual QList predefinedStyles() = 0;
- /** Load the predefined type of name \arg name, or if the first arg is empty, the style
- * defined by the options string \arg content.
- */
- virtual void setStyle(const SourceFormatterStyle&) = 0;
-
- virtual SourceFormatterStyle style() const = 0;
-
/** \return The widget to edit a style.
*/
virtual SettingsWidget* editStyleWidget(const KMimeType::Ptr &mime) = 0;
diff -Nru kdevplatform-0.9.98/interfaces/kdevelopplugin.desktop kdevplatform-1.0.1/interfaces/kdevelopplugin.desktop
--- kdevplatform-0.9.98/interfaces/kdevelopplugin.desktop 2010-01-25 10:41:17.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/kdevelopplugin.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -7,6 +7,7 @@
Name[ca]=Connector KDevelop
Name[ca@valencia]=Connector KDevelop
Name[cs]=Modul KDevelop
+Name[da]=KDevelop-plugin
Name[de]=KDevelop-Modul
Name[el]=Πρόσθετο του KDevelop
Name[en_GB]=KDevelop Plugin
@@ -16,16 +17,19 @@
Name[ga]=Breiseán KDevelop
Name[gl]=Engadido para KDevelop
Name[hr]=KDevelop priključak
+Name[it]=Estensione KDevelop
Name[ja]=KDevelop プラグイン
Name[lv]=KDevelop spraudnis
Name[nb]=KDevelop programtillegg
Name[nds]=KDevelop-Moduul
+Name[nl]=Plugin van KDevelop
Name[pa]=KDevelop ਪਲੱਗਇਨ
Name[pl]=Wtyczka do KDevelopa
Name[pt]='Plugin' do KDevelop
Name[pt_BR]=Extensão do KDevelop
Name[ro]=Modul KDevelop
Name[ru]=Модуль KDevelop
+Name[sl]=Vstavek za KDevelop
Name[sv]=KDevelop-insticksprogram
Name[tr]=KDevelop Eklentisi
Name[uk]=Додаток KDevelop
diff -Nru kdevplatform-0.9.98/interfaces/launchconfigurationtype.h kdevplatform-1.0.1/interfaces/launchconfigurationtype.h
--- kdevplatform-0.9.98/interfaces/launchconfigurationtype.h 2009-10-31 19:07:41.000000000 +0000
+++ kdevplatform-1.0.1/interfaces/launchconfigurationtype.h 2010-07-17 19:58:27.000000000 +0100
@@ -23,6 +23,7 @@
#include "interfacesexport.h"
#include
+#include
class KIcon;
class KUrl;
@@ -112,7 +113,15 @@
*/
virtual void configureLaunchFromItem( KConfigGroup config,
KDevelop::ProjectBaseItem* item ) const = 0;
-
+
+ /**
+ * Configure the given launch configuration to execute the selected item
+ * @param config the configuration to setup
+ * @param item the item to launch
+ */
+ virtual void configureLaunchFromCmdLineArguments( KConfigGroup config,
+ const QStringList &args ) const = 0;
+
/**
* Check wether this launch configuration type can launch the given file
* @param file the file to test launchability
diff -Nru kdevplatform-0.9.98/language/backgroundparser/backgroundparser.cpp kdevplatform-1.0.1/language/backgroundparser/backgroundparser.cpp
--- kdevplatform-0.9.98/language/backgroundparser/backgroundparser.cpp 2009-12-13 15:29:52.000000000 +0000
+++ kdevplatform-1.0.1/language/backgroundparser/backgroundparser.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -233,7 +233,7 @@
//Notify that we failed
typedef QPointer Notify;
- foreach(Notify n, notifyWhenReady)
+ foreach(const Notify& n, notifyWhenReady)
if(n)
QMetaObject::invokeMethod(n, "updateReady", Qt::DirectConnection, Q_ARG(KDevelop::IndexedString, IndexedString(url)), Q_ARG(KDevelop::ReferencedTopDUContext, ReferencedTopDUContext()));
@@ -557,6 +557,12 @@
return d->m_documents.contains(url) || d->m_delayedParseJobs.contains(url);
}
+int BackgroundParser::queuedCount() const
+{
+ QMutexLocker lock(&d->m_mutex);
+ return d->m_documents.count() + d->m_delayedParseJobs.count();
+}
+
void BackgroundParser::setNeededPriority(int priority)
{
QMutexLocker lock(&d->m_mutex);
@@ -635,14 +641,15 @@
void BackgroundParser::addManagedTopRange(const KUrl& document, KTextEditor::SmartRange* range)
{
- range->addWatcher(this);
+ Q_ASSERT(range);
+ range->addWatcher(this); ///@todo Smart-lock
QMutexLocker l(&d->m_mutex);
d->m_managedRanges.insert(range, document);
}
void BackgroundParser::removeManagedTopRange(KTextEditor::SmartRange* range)
{
- range->removeWatcher(this);
+ range->removeWatcher(this); ///@todo Smart-lock
QMutexLocker l(&d->m_mutex);
d->m_managedRanges.remove(range);
}
diff -Nru kdevplatform-0.9.98/language/backgroundparser/backgroundparser.h kdevplatform-1.0.1/language/backgroundparser/backgroundparser.h
--- kdevplatform-0.9.98/language/backgroundparser/backgroundparser.h 2009-12-08 13:31:07.000000000 +0000
+++ kdevplatform-1.0.1/language/backgroundparser/backgroundparser.h 2010-07-17 19:58:27.000000000 +0100
@@ -196,7 +196,10 @@
///Returns true if the given url is queued for parsing
bool isQueued(KUrl url) const;
-
+
+ ///Returns the number of currently active or queued jobs
+ int queuedCount() const;
+
protected:
void loadSettings(bool projectIsLoaded);
void saveSettings(bool projectIsLoaded);
diff -Nru kdevplatform-0.9.98/language/backgroundparser/parsejob.cpp kdevplatform-1.0.1/language/backgroundparser/parsejob.cpp
--- kdevplatform-0.9.98/language/backgroundparser/parsejob.cpp 2010-01-14 21:22:17.000000000 +0000
+++ kdevplatform-1.0.1/language/backgroundparser/parsejob.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -105,27 +105,16 @@
ParseJob::~ParseJob()
{
- //Here we release the revision
- EditorIntegrator editor;
- editor.setCurrentUrl(d->document);
-
- if(KDevelop::LockedSmartInterface smart = editor.smart()) {
- smart->releaseRevision(d->revisionToken);
- smart->clearRevision();
- ///@todo We need to know here what the currently used revision is, and assert that it still is being used
- }
- {
- //Only for testing
- DUChainReadLocker lock(DUChain::lock());
- if(d->duContext)
- d->duContext->parsingEnvironmentFile();
+ if ( d->revisionToken != -1 ) {
+ kWarning() << "You must call cleanupSmartRevision() when your run() method has finished!";
+ cleanupSmartRevision();
}
-
+
typedef QPointer QObjectPointer;
foreach(const QObjectPointer &p, d->notify)
if(p)
QMetaObject::invokeMethod(p, "updateReady", Qt::QueuedConnection, Q_ARG(KDevelop::IndexedString, d->document), Q_ARG(KDevelop::ReferencedTopDUContext, d->duContext));
-
+
delete d;
}
@@ -203,6 +192,22 @@
return true;
}
+void ParseJob::cleanupSmartRevision()
+{
+ if ( d->revisionToken != -1 ) {
+ //Here we release the revision
+ EditorIntegrator editor;
+ editor.setCurrentUrl(d->document);
+
+ if(KDevelop::LockedSmartInterface smart = editor.smart()) {
+ smart->releaseRevision(d->revisionToken);
+ smart->clearRevision();
+ d->revisionToken = -1;
+ ///@todo We need to know here what the currently used revision is, and assert that it still is being used
+ }
+ }
+}
+
int ParseJob::revisionToken() const
{
return d->revisionToken;
@@ -284,6 +289,7 @@
{
d->aborted = true;
setFinished(true);
+ cleanupSmartRevision();
}
void ParseJob::setNotifyWhenReady(QList > notify) {
diff -Nru kdevplatform-0.9.98/language/backgroundparser/parsejob.h kdevplatform-1.0.1/language/backgroundparser/parsejob.h
--- kdevplatform-0.9.98/language/backgroundparser/parsejob.h 2009-11-02 18:12:41.000000000 +0000
+++ kdevplatform-1.0.1/language/backgroundparser/parsejob.h 2010-07-17 19:58:27.000000000 +0100
@@ -59,9 +59,18 @@
* be made to the changedRanges().
* You can then just call KTextEditor::SmartRange::text() on each of the changedRanges().
* Or, you can parse the whole document, the text of which is available from contentsFromEditor().
+ *
+ * @NOTE: When this is called, make sure you call @p cleanupSmartRevision() properly.
*/
Q_SCRIPTABLE bool contentsAvailableFromEditor();
+ /**
+ * Cleanup SmartRange revision after the job has run.
+ * You must call this before exiting your @p run() method.
+ * @p abortJob() will call this automatically.
+ */
+ virtual void cleanupSmartRevision();
+
/// Retrieve the contents of the file from the currently open editor.
/// Ensure it is loaded by calling editorLoaded() first.
/// The editor integrator seamlessly saves the revision token and applies it
diff -Nru kdevplatform-0.9.98/language/backgroundparser/parseprojectjob.cpp kdevplatform-1.0.1/language/backgroundparser/parseprojectjob.cpp
--- kdevplatform-0.9.98/language/backgroundparser/parseprojectjob.cpp 2009-12-06 03:03:29.000000000 +0000
+++ kdevplatform-1.0.1/language/backgroundparser/parseprojectjob.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -77,7 +77,7 @@
TopDUContext::Features processingLevel = files.size() < ICore::self()->languageController()->completionSettings()->minFilesForSimplifiedParsing() ?
KDevelop::TopDUContext::VisibleDeclarationsAndContexts : KDevelop::TopDUContext::SimplifiedVisibleDeclarationsAndContexts;
- foreach(KDevelop::IndexedString url, files)
+ foreach(const KDevelop::IndexedString& url, files)
KDevelop::ICore::self()->languageController()->backgroundParser()->addDocument( url.toUrl(), processingLevel, 10000, this );
}
diff -Nru kdevplatform-0.9.98/language/backgroundparser/urlparselock.cpp kdevplatform-1.0.1/language/backgroundparser/urlparselock.cpp
--- kdevplatform-0.9.98/language/backgroundparser/urlparselock.cpp 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/language/backgroundparser/urlparselock.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -0,0 +1,54 @@
+/*
+* This file is part of KDevelop
+*
+* Copyright 2007-2009 David Nolden
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Library General Public License as
+* published by the Free Software Foundation; either version 2 of the
+* License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public
+* License along with this program; if not, write to the
+* Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include "urlparselock.h"
+
+#include
+
+namespace KDevelop {
+
+///Facilities to prevent multiple parse-jobs from processing the same url.
+QMutex urlParseMutex;
+QMap > parsingUrls;
+
+UrlParseLock::UrlParseLock(IndexedString url) : m_url(url) {
+ QMutexLocker lock(&urlParseMutex);
+ while(parsingUrls.contains(m_url) && parsingUrls[m_url].first != QThread::currentThreadId()) {
+ //Wait here until no other thread is updating parsing the url
+ lock.unlock();
+ sleep(1);
+ lock.relock();
+ }
+ if(parsingUrls.contains(m_url))
+ ++parsingUrls[m_url].second;
+ else
+ parsingUrls.insert(m_url, qMakePair(QThread::currentThreadId(), 1u));
+}
+
+UrlParseLock::~UrlParseLock() {
+ QMutexLocker lock(&urlParseMutex);
+ Q_ASSERT(parsingUrls.contains(m_url));
+ Q_ASSERT(parsingUrls[m_url].first == QThread::currentThreadId());
+ --parsingUrls[m_url].second;
+ if(parsingUrls[m_url].second == 0)
+ parsingUrls.remove(m_url);
+}
+
+}
diff -Nru kdevplatform-0.9.98/language/backgroundparser/urlparselock.h kdevplatform-1.0.1/language/backgroundparser/urlparselock.h
--- kdevplatform-0.9.98/language/backgroundparser/urlparselock.h 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/language/backgroundparser/urlparselock.h 2010-07-17 19:58:27.000000000 +0100
@@ -0,0 +1,38 @@
+/*
+* This file is part of KDevelop
+*
+* Copyright 2007-2009 David Nolden
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Library General Public License as
+* published by the Free Software Foundation; either version 2 of the
+* License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public
+* License along with this program; if not, write to the
+* Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#ifndef URLPARSELOCK_H
+#define URLPARSELOCK_H
+
+#include "../duchain/indexedstring.h"
+
+namespace KDevelop
+{
+
+class KDEVPLATFORMLANGUAGE_EXPORT UrlParseLock {
+public:
+ UrlParseLock(IndexedString url);
+ ~UrlParseLock();
+ IndexedString m_url;
+};
+
+}
+
+#endif
diff -Nru kdevplatform-0.9.98/language/CMakeLists.txt kdevplatform-1.0.1/language/CMakeLists.txt
--- kdevplatform-0.9.98/language/CMakeLists.txt 2010-01-16 00:06:18.000000000 +0000
+++ kdevplatform-1.0.1/language/CMakeLists.txt 2010-07-17 19:58:27.000000000 +0100
@@ -17,6 +17,7 @@
backgroundparser/parserdependencypolicy.cpp
backgroundparser/documentchangetracker.cpp
backgroundparser/parseprojectjob.cpp
+ backgroundparser/urlparselock.cpp
duchain/referencecounting.cpp
duchain/specializationstore.cpp
@@ -107,7 +108,7 @@
codegen/applychangeswidget.cpp
codegen/createclass.cpp
- codegen/codegenerator.cpp
+ #codegen/codegenerator.cpp
codegen/coderepresentation.cpp
codegen/documentchangeset.cpp
codegen/duchainchangeset.cpp
@@ -186,6 +187,7 @@
install(FILES
backgroundparser/backgroundparser.h
backgroundparser/parsejob.h
+ backgroundparser/urlparselock.h
backgroundparser/documentchangetracker.h
DESTINATION ${INCLUDE_INSTALL_DIR}/kdevplatform/language/backgroundparser COMPONENT Devel
)
@@ -205,7 +207,6 @@
duchain/codemodel.h
duchain/ducontext.h
duchain/ducontextdata.h
- duchain/arrayhelpers.h
duchain/topducontext.h
duchain/topducontextutils.h
duchain/topducontextdata.h
@@ -305,7 +306,7 @@
codegen/overridespage.h
codegen/astchangeset.h
codegen/duchainchangeset.h
- codegen/codegenerator.h
+ #codegen/codegenerator.h
codegen/documentchangeset.h
codegen/coderepresentation.h
codegen/utilities.h
@@ -327,6 +328,7 @@
install(FILES
highlighting/codehighlighting.h
highlighting/colorcache.h
+ highlighting/configurablecolors.h
DESTINATION ${INCLUDE_INSTALL_DIR}/kdevplatform/language/highlighting COMPONENT Devel
)
diff -Nru kdevplatform-0.9.98/language/codecompletion/codecompletion.cpp kdevplatform-1.0.1/language/codecompletion/codecompletion.cpp
--- kdevplatform-0.9.98/language/codecompletion/codecompletion.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/codecompletion/codecompletion.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -34,6 +34,7 @@
#include "../duchain/duchain.h"
#include "../duchain/topducontext.h"
#include "codecompletionmodel.h"
+#include
using namespace KTextEditor;
using namespace KDevelop;
@@ -46,13 +47,26 @@
kdevModel->initialize();
connect (KDevelop::ICore::self()->partController(), SIGNAL(partAdded(KParts::Part*)),
SLOT(documentLoaded(KParts::Part*)));
+ connect( KDevelop::ICore::self()->documentController(), SIGNAL(documentSaved(KDevelop::IDocument*)), SLOT(documentSaved(KDevelop::IDocument*)) );
aModel->setParent(this);
+
+ // prevent deadlock
+ QMetaObject::invokeMethod(this, "checkDocuments", Qt::QueuedConnection);
}
CodeCompletion::~CodeCompletion()
{
}
+void CodeCompletion::checkDocuments()
+{
+ foreach( KDevelop::IDocument* doc, KDevelop::ICore::self()->documentController()->openDocuments() ) {
+ if (doc->textDocument()) {
+ checkDocument(doc->textDocument());
+ }
+ }
+}
+
void CodeCompletion::viewCreated(KTextEditor::Document * document, KTextEditor::View * view)
{
Q_UNUSED(document);
@@ -63,31 +77,57 @@
}
}
+void CodeCompletion::documentSaved(KDevelop::IDocument* document)
+{
+ // The URL may have changed, so we re-register the document
+ Document* textDocument = document->textDocument();
+
+ if(textDocument)
+ {
+ unregisterDocument(textDocument);
+ checkDocument(textDocument);
+ }
+}
+
void CodeCompletion::documentLoaded(KParts::Part* document)
{
KTextEditor::Document *textDocument = dynamic_cast(document);
if (textDocument) {
- QList langs=ICore::self()->languageController()->languagesForUrl( textDocument->url() );
-
- bool found=false;
- foreach(ILanguage* lang, langs) {
- if(m_language==lang->name()) {
- found=true;
- break;
- }
- }
- if(!found && !m_language.isEmpty())
- return;
-
- foreach (KTextEditor::View* view, textDocument->views())
- viewCreated(textDocument, view);
-
- connect(textDocument, SIGNAL(viewCreated(KTextEditor::Document*, KTextEditor::View*)), SLOT(viewCreated(KTextEditor::Document*, KTextEditor::View*)));
-
+ checkDocument(textDocument);
} else {
kDebug() << "Non-text editor document added";
}
}
+void CodeCompletion::unregisterDocument(Document* textDocument)
+{
+ foreach (KTextEditor::View* view, textDocument->views())
+ if (CodeCompletionInterface* cc = dynamic_cast(view))
+ cc->unregisterCompletionModel(m_model);
+
+ disconnect(textDocument, SIGNAL(viewCreated(KTextEditor::Document*, KTextEditor::View*)), this, SLOT(viewCreated(KTextEditor::Document*, KTextEditor::View*)));
+}
+
+void CodeCompletion::checkDocument(Document* textDocument)
+{
+ QList langs=ICore::self()->languageController()->languagesForUrl( textDocument->url() );
+
+ bool found=false;
+ foreach(ILanguage* lang, langs) {
+ if(m_language==lang->name()) {
+ found=true;
+ break;
+ }
+ }
+ if(!found && !m_language.isEmpty())
+ return;
+
+ foreach (KTextEditor::View* view, textDocument->views())
+ viewCreated(textDocument, view);
+
+ connect(textDocument, SIGNAL(viewCreated(KTextEditor::Document*, KTextEditor::View*)), SLOT(viewCreated(KTextEditor::Document*, KTextEditor::View*)));
+}
+
+
#include "codecompletion.moc"
diff -Nru kdevplatform-0.9.98/language/codecompletion/codecompletion.h kdevplatform-1.0.1/language/codecompletion/codecompletion.h
--- kdevplatform-0.9.98/language/codecompletion/codecompletion.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/codecompletion/codecompletion.h 2010-07-17 19:58:27.000000000 +0100
@@ -26,10 +26,13 @@
#include "../languageexport.h"
namespace KParts { class Part; }
-namespace KTextEditor { class Document; class View; class CodeCompletionModel; }
+namespace KTextEditor { class Document; class View; class CodeCompletionModel;
+}
namespace KDevelop
{
+
+class IDocument;
class ILanguage;
class KDEVPLATFORMLANGUAGE_EXPORT CodeCompletion : public QObject
@@ -47,8 +50,21 @@
public Q_SLOTS:
void documentLoaded(KParts::Part* document);
void viewCreated(KTextEditor::Document *document, KTextEditor::View *view);
+ void documentSaved(KDevelop::IDocument*);
+
+ private Q_SLOTS:
+ /**
+ * check already opened documents,
+ * needs to be done via delayed call to prevent infinite loop in
+ * checkDocument() -> load lang plugin -> register CodeCompletion -> checkDocument() -> ...
+ */
+ void checkDocuments();
private:
+
+ void unregisterDocument(KTextEditor::Document*);
+ void checkDocument(KTextEditor::Document*);
+
KTextEditor::CodeCompletionModel* m_model;
QString m_language;
};
diff -Nru kdevplatform-0.9.98/language/codecompletion/codecompletionhelper.cpp kdevplatform-1.0.1/language/codecompletion/codecompletionhelper.cpp
--- kdevplatform-0.9.98/language/codecompletion/codecompletionhelper.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/codecompletion/codecompletionhelper.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -21,6 +21,7 @@
#include "../duchain/declaration.h"
#include "../duchain/duchainlock.h"
#include "../duchain/types/functiontype.h"
+#include "../duchain/types/integraltype.h"
#include
#include
@@ -40,7 +41,9 @@
if(!declaration)
return;
- if( declaration->kind() == Declaration::Type || (declaration->type() && declaration->type()->indexedArgumentsSize()) )
+ TypePtr< FunctionType > funcType = declaration->type();
+
+ if( declaration->kind() == Declaration::Type || (funcType && funcType->indexedArgumentsSize()) )
haveArguments = true;
if( declaration->kind() == Declaration::Instance && !declaration->isFunctionDeclaration())
@@ -71,10 +74,20 @@
KTextEditor::Cursor jumpPos = word.end() + KTextEditor::Cursor( 0, openingParen.length() );
- //If no arguments, move the cursor behind the closing paren
+ // when function returns void, also add a semicolon
+ if (funcType) {
+ if (IntegralType::Ptr type = funcType->returnType().cast()) {
+ if (type->dataType() == IntegralType::TypeVoid) {
+ closingParen += ';';
+ }
+ }
+ }
+
+ //If no arguments, move the cursor behind the closing paren (or semicolon)
if( !haveArguments )
jumpPos += KTextEditor::Cursor( 0, closingParen.length() );
+
lock.unlock();
document->insertText( word.end(), openingParen + closingParen );
if(!jumpForbidden) {
diff -Nru kdevplatform-0.9.98/language/codegen/applychangeswidget.cpp kdevplatform-1.0.1/language/codegen/applychangeswidget.cpp
--- kdevplatform-0.9.98/language/codegen/applychangeswidget.cpp 2009-12-18 15:04:24.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/applychangeswidget.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -62,11 +62,11 @@
ApplyChangesWidget * const parent;
- unsigned int m_index;
+ int m_index;
QList m_editParts;
QList m_changes;
QList m_temps;
- QList > m_files;
+ QList m_files;
KTabWidget * m_documentTabs;
QLabel* m_info;
@@ -115,22 +115,20 @@
d->m_info->setText(info);
}
-void ApplyChangesWidget::addDocuments(const IndexedString & original, const IndexedString & modified)
+void ApplyChangesWidget::addDocuments(const IndexedString & original)
{
-
- QWidget * w = new QWidget;
- d->m_documentTabs->addTab(w, original.index() ? original.str() : modified.str());
- d->m_documentTabs->setCurrentWidget(w);
-
-#ifndef NDEBUG
- //Duplicated originals should not exist
- typedef QPair StringPair;
- foreach( StringPair files, d->m_files)
- Q_ASSERT(files.first != original);
-#endif
- d->m_files.insert(d->m_index, qMakePair(original, modified));
-
- d->createEditPart(modified);
+ int idx=d->m_files.indexOf(original);
+ if(idx<0) {
+ QWidget * w = new QWidget;
+ d->m_documentTabs->addTab(w, original.str());
+ d->m_documentTabs->setCurrentWidget(w);
+
+
+ d->m_files.insert(d->m_index, original);
+ d->createEditPart(original);
+ } else {
+ d->m_index=idx;
+ }
switchEditView();
}
@@ -139,8 +137,8 @@
/// @todo implement safeguard in case a file saving fails
bool ret = true;
- for(unsigned int i = 0; i < static_cast(d->m_files.size()); ++i )
- if(!d->m_editParts[i]->saveAs(d->m_files[i].first.toUrl()))
+ for(int i = 0; i < d->m_files.size(); ++i )
+ if(!d->m_editParts[i]->saveAs(d->m_files[i].toUrl()))
ret = false;
return ret;
@@ -177,7 +175,7 @@
void ApplyChangesWidgetPrivate::jump( const QModelIndex & idx)
{
- Q_ASSERT( static_cast(m_index) == m_documentTabs->currentIndex());
+ Q_ASSERT( m_index == m_documentTabs->currentIndex());
QStandardItem *it=m_changes[m_index]->itemFromIndex(idx);
KTextEditor::View* view=qobject_cast(m_editParts[m_index]->widget());
@@ -282,7 +280,7 @@
{
d->m_editParts[d->m_index]->widget()->parentWidget()->setVisible(false);
//Change into KomparePart
- d->m_kompare.compare(d->m_files[d->m_index].first, document()->text(),
+ d->m_kompare.compare(d->m_files[d->m_index], document()->text(),
d->m_documentTabs->widget(d->m_index), d->m_index);
}
diff -Nru kdevplatform-0.9.98/language/codegen/applychangeswidget.h kdevplatform-1.0.1/language/codegen/applychangeswidget.h
--- kdevplatform-0.9.98/language/codegen/applychangeswidget.h 2009-09-05 23:46:23.000000000 +0100
+++ kdevplatform-1.0.1/language/codegen/applychangeswidget.h 2010-07-17 19:58:27.000000000 +0100
@@ -43,7 +43,8 @@
KTextEditor::Document* document() const;
- void addDocuments(const IndexedString & original, const IndexedString & modified);
+ ///@param modified may be an artifial code representation (@ref KDevelop::InsertArtificialCodeRepresentation)
+ void addDocuments(const IndexedString & original);
///This will save all the modified files into their originals
bool applyAllChanges();
diff -Nru kdevplatform-0.9.98/language/codegen/codegenerator.cpp kdevplatform-1.0.1/language/codegen/codegenerator.cpp
--- kdevplatform-0.9.98/language/codegen/codegenerator.cpp 2009-10-09 08:27:30.000000000 +0100
+++ kdevplatform-1.0.1/language/codegen/codegenerator.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -117,7 +117,7 @@
delete changeSet;
d->duchainChanges.clear();
- d->documentChanges.clear();
+ d->documentChanges = DocumentChangeSet();
}
bool CodeGeneratorBase::execute()
diff -Nru kdevplatform-0.9.98/language/codegen/coderepresentation.cpp kdevplatform-1.0.1/language/codegen/coderepresentation.cpp
--- kdevplatform-0.9.98/language/codegen/coderepresentation.cpp 2010-01-27 23:22:25.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/coderepresentation.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -51,9 +51,9 @@
m_url = IndexedString(m_document->url());
}
QString line(int line) const {
- if(line < 0 || line >= m_document->lines())
- return QString();
- return m_document->line(line);
+ if(line < 0 || line >= m_document->lines())
+ return QString();
+ return m_document->line(line);
}
virtual int lines() const {
@@ -110,17 +110,17 @@
QFile file( localFile );
if ( file.open(QIODevice::ReadOnly) ) {
- data = file.readAll();
- lineData = data.split('\n');
+ data = QString::fromLocal8Bit(file.readAll());
+ lineData = data.split('\n');
}
m_exists = file.exists();
}
QString line(int line) const {
- if(line < 0 || line >= lineData.size())
- return QString();
+ if(line < 0 || line >= lineData.size())
+ return QString();
- return QString::fromLocal8Bit(lineData[line]);
+ return lineData.at(line);
}
virtual int lines() const {
@@ -128,7 +128,7 @@
}
QString text() const {
- return QString::fromLocal8Bit(data);
+ return data;
}
bool setText(QString text) {
@@ -157,8 +157,8 @@
//We use QByteArray, because the column-numbers are measured in utf-8
IndexedString m_document;
bool m_exists;
- QList lineData;
- QByteArray data;
+ QStringList lineData;
+ QString data;
};
class ArtificialStringData : public QSharedData {
@@ -188,10 +188,10 @@
}
QString line(int line) const {
- if(line < 0 || line >= data->lines().size())
- return QString();
+ if(line < 0 || line >= data->lines().size())
+ return QString();
- return data->lines()[line];
+ return data->lines().at(line);
}
virtual int lines() const {
@@ -240,12 +240,12 @@
CodeRepresentation::Ptr createCodeRepresentation(IndexedString url) {
if(artificialCodeRepresentationExists(url))
return CodeRepresentation::Ptr(new StringCodeRepresentation(representationForUrl(url)));
-
- IDocument* document = ICore::self()->documentController()->documentForUrl(url.toUrl());
- if(document && document->textDocument())
- return CodeRepresentation::Ptr(new EditorCodeRepresentation(document->textDocument()));
- else
- return CodeRepresentation::Ptr(new FileCodeRepresentation(url));
+
+ IDocument* document = ICore::self()->documentController()->documentForUrl(url.toUrl());
+ if(document && document->textDocument())
+ return CodeRepresentation::Ptr(new EditorCodeRepresentation(document->textDocument()));
+ else
+ return CodeRepresentation::Ptr(new FileCodeRepresentation(url));
}
void CodeRepresentation::setDiskChangesForbidden(bool changesForbidden)
@@ -263,10 +263,20 @@
}
InsertArtificialCodeRepresentation::InsertArtificialCodeRepresentation(IndexedString file, QString text) : m_file(file) {
- Q_ASSERT(!artificialStrings.contains(m_file));
if(m_file.toUrl().isRelative())
- m_file = IndexedString(CodeRepresentation::artificialUrl(m_file.str()));
+ {
+ m_file = IndexedString(CodeRepresentation::artificialUrl(file.str()));
+
+ int idx = 0;
+ while(artificialStrings.contains(m_file))
+ {
+ ++idx;
+ m_file = IndexedString(CodeRepresentation::artificialUrl(QString("%1_%2").arg(idx).arg(file.str())));
+ }
+ }
+ Q_ASSERT(!artificialStrings.contains(m_file));
+
artificialStrings.insert(m_file, KSharedPtr(new ArtificialStringData(text)));
}
diff -Nru kdevplatform-0.9.98/language/codegen/coderepresentation.h kdevplatform-1.0.1/language/codegen/coderepresentation.h
--- kdevplatform-0.9.98/language/codegen/coderepresentation.h 2009-12-06 02:51:39.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/coderepresentation.h 2010-07-17 19:58:27.000000000 +0100
@@ -100,7 +100,8 @@
public:
/**
* Inserts an artifial source-code representation with filename @p file and the contents @p text
- * If @p file is not an absolute path or url, it will be made absolute using the CodeRepresentation::artifialUrl() function.
+ * If @p file is not an absolute path or url, it will be made absolute using the CodeRepresentation::artifialUrl()
+ * function, while ensuring that the name is unique.
*/
InsertArtificialCodeRepresentation(IndexedString file, QString text);
~InsertArtificialCodeRepresentation();
diff -Nru kdevplatform-0.9.98/language/codegen/createclass.cpp kdevplatform-1.0.1/language/codegen/createclass.cpp
--- kdevplatform-0.9.98/language/codegen/createclass.cpp 2010-01-18 21:37:50.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/createclass.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -116,6 +116,7 @@
DocumentChangeSet changes = d->generator->generate();
changes.setReplacementPolicy(DocumentChangeSet::WarnOnFailedChange);
+ changes.setActivationPolicy(KDevelop::DocumentChangeSet::Activate);
changes.applyAllChanges();
}
@@ -357,6 +358,7 @@
connect(d->classid->removeInheritancePushButton, SIGNAL(pressed()), this, SLOT(removeInheritance()));
connect(d->classid->moveUpPushButton, SIGNAL(pressed()), this, SLOT(moveUpInheritance()));
connect(d->classid->moveDownPushButton, SIGNAL(pressed()), this, SLOT(moveDownInheritance()));
+ connect(d->classid->inheritanceList, SIGNAL(currentRowChanged(int)), this, SLOT(checkMoveButtonState()));
registerField("classIdentifier*", d->classid->identifierLineEdit);
registerField("classInheritance", this, "inheritance", SIGNAL(inheritanceChanged()));
@@ -398,6 +400,8 @@
if (d->classid->inheritanceList->count() == 0)
d->classid->removeInheritancePushButton->setEnabled(false);
+ checkMoveButtonState();
+
emit inheritanceChanged();
}
@@ -411,6 +415,7 @@
QListWidgetItem* item = d->classid->inheritanceList->takeItem(currentRow);
d->classid->inheritanceList->insertItem(currentRow - 1, item);
+ d->classid->inheritanceList->setCurrentItem(item);
emit inheritanceChanged();
}
@@ -425,6 +430,7 @@
QListWidgetItem* item = d->classid->inheritanceList->takeItem(currentRow);
d->classid->inheritanceList->insertItem(currentRow + 1, item);
+ d->classid->inheritanceList->setCurrentItem(item);
emit inheritanceChanged();
}
@@ -549,7 +555,7 @@
QStringList licenseDirs = dirs->findDirs("data", "kdevcodegen/licenses");
//Iterate through the possible directories that contain licenses, and load their names
- foreach(QString currentDir, licenseDirs)
+ foreach(const QString& currentDir, licenseDirs)
{
QDirIterator it(currentDir, QDir::Files | QDir::Readable);
while(it.hasNext())
diff -Nru kdevplatform-0.9.98/language/codegen/createclass.h kdevplatform-1.0.1/language/codegen/createclass.h
--- kdevplatform-0.9.98/language/codegen/createclass.h 2010-01-18 21:37:50.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/createclass.h 2010-07-17 19:58:27.000000000 +0100
@@ -95,9 +95,11 @@
*/
virtual QualifiedIdentifier parseParentClassId(const QString& inheritedObject);
-private:
+private Q_SLOTS:
void checkMoveButtonState();
+private:
+
class ClassIdentifierPagePrivate* const d;
};
diff -Nru kdevplatform-0.9.98/language/codegen/documentchangeset.cpp kdevplatform-1.0.1/language/codegen/documentchangeset.cpp
--- kdevplatform-0.9.98/language/codegen/documentchangeset.cpp 2009-12-04 19:40:23.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/documentchangeset.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -41,11 +41,9 @@
DocumentChangeSet::ReplacementPolicy replacePolicy;
DocumentChangeSet::FormatPolicy formatPolicy;
DocumentChangeSet::DUChainUpdateHandling updatePolicy;
+ DocumentChangeSet::ActivationPolicy activationPolicy;
- typedef QPair TempPair;
- QMap< IndexedString, TempPair > tempFiles;
QMap< IndexedString, QList > changes;
- QMap< IndexedString, IndexedString > tempToOriginal;
DocumentChangeSet::ChangeResult addChange(DocumentChangePointer change);
DocumentChangeSet::ChangeResult replaceOldText(CodeRepresentation * repr, const QString & newText, const QList & sortedChangesList);
@@ -53,11 +51,6 @@
DocumentChangeSet::ChangeResult removeDuplicates(const IndexedString & file, QList & filteredChanges);
void formatChanges();
void updateFiles();
- void addFileToProject(IndexedString file);
- void addTempFile(IndexedString originalName, const QString & text);
- void adjustChangeToTemp(DocumentChangePointer newChange);
- QList withoutOriginals();
- DocumentChangeSet::ChangeResult replaceOriginalsWithTemps();
};
//Simple helper to clear up code clutter
@@ -90,6 +83,7 @@
d->replacePolicy = StopOnFailedChange;
d->formatPolicy = AutoFormatChanges;
d->updatePolicy = SimpleUpdate;
+ d->activationPolicy = DoNotActivate;
}
DocumentChangeSet::DocumentChangeSet(const DocumentChangeSet & rhs) : d(new DocumentChangeSetPrivate(*rhs.d))
@@ -112,80 +106,19 @@
return d->addChange(DocumentChangePointer(new DocumentChange(change)));
}
+DocumentChangeSet::ChangeResult DocumentChangeSet::addChange(DocumentChangePointer change)
+{
+ return d->addChange(change);
+}
+
DocumentChangeSet::ChangeResult DocumentChangeSetPrivate::addChange(DocumentChangePointer change) {
if(change->m_range.start.line != change->m_range.end.line)
return DocumentChangeSet::ChangeResult("Multi-line ranges are not supported");
- if(tempFiles.contains(change->m_document))
- adjustChangeToTemp(change);
-
changes[change->m_document].append(change);
return true;
}
-/*
- * Merges the changes from both DocumentChangeSets.
- * Merging changes from two changesets that have each applied temp changes is not supported
- * When temp files have been created in one change set, but not the other, all the changes from the
- * original file need to be adjusted, so they correspond to the temp version.
- */
-DocumentChangeSet & DocumentChangeSet::operator<<(DocumentChangeSet & rhs)
-{
-#ifndef NDEBUG
- kDebug() << "Merging DocumentChangeSets, tempFiles.\nTemp Files in lhs:";
- for(QMap ::iterator it = d->tempFiles.begin();
- it != d->tempFiles.end(); ++it)
- kDebug() << it.key().str() << " " << it->first.str();
- kDebug() << "Temp Files in rhs: ";
- for(QMap ::iterator it = rhs.d->tempFiles.begin();
- it != rhs.d->tempFiles.end(); ++it)
- kDebug() << it.key().str() << " " << it->first.str();
-#endif //NDEBUG
-
- //If a temp has been created on the rhs changeset, then the changes in this one must be adjusted
- //This is not an efficient method of adjusting them, however it is simpler to manage
- foreach(const IndexedString & file, rhs.d->tempFiles.keys())
- if(d->changes.contains(file))
- {
- foreach(const DocumentChangePointer & change, d->changes[file])
- rhs.d->addChange(change);
- d->changes.remove(file);
- }
-
- /// @todo Possibly check for duplicates, since it could create a lot of bloat when big changes are merged
- foreach(const QList & changeList, rhs.d->changes.values())
- foreach(const DocumentChangePointer & change, changeList)
- d->addChange(change);
-
- /// @todo Fix for a possibility of two different temporaries created for the same fileName
- d->tempFiles.unite(rhs.d->tempFiles);
- Q_ASSERT(d->tempFiles.uniqueKeys().size() == d->tempFiles.size());
- d->tempToOriginal.unite(rhs.d->tempToOriginal);
-
- rhs.clear();
-
-#ifndef NDEBUG
- kDebug() << "Merged Changes: ";
- for(QMap >::iterator it = d->changes.begin();
- it != d->changes.end(); ++it)
- {
- kDebug() << it.key().str();
- foreach(DocumentChangePointer p, *it)
- kDebug() << p->m_newText;
- }
-#endif //NDEBUG
-
-
- return *this;
-}
-
-void DocumentChangeSet::clear ()
-{
- d->tempFiles.clear();
- d->changes.clear();
- d->tempToOriginal.clear();
-}
-
void DocumentChangeSet::setReplacementPolicy ( DocumentChangeSet::ReplacementPolicy policy )
{
d->replacePolicy = policy;
@@ -201,147 +134,40 @@
d->updatePolicy = policy;
}
-
-IndexedString DocumentChangeSet::tempNameForFile ( IndexedString file ) const
+void DocumentChangeSet::setActivationPolicy(DocumentChangeSet::ActivationPolicy policy)
{
- if(d->tempFiles.contains(file))
- file = d->tempFiles[file].first;
-
- return file;
+ d->activationPolicy = policy;
}
-QMap DocumentChangeSet::tempNamesForAll() const
+QMap< IndexedString, InsertArtificialCodeRepresentationPointer > DocumentChangeSet::temporaryCodeRepresentations() const
{
- QMap names;
- for(QMap< IndexedString, DocumentChangeSetPrivate::TempPair >::Iterator it = d->tempFiles.begin();
- it != d->tempFiles.end(); ++it)
- names[it.key()] = it.value().first;
+ QMap< IndexedString, InsertArtificialCodeRepresentationPointer > ret;
- return names;
-}
-
-DocumentChangeSet::ChangeResult DocumentChangeSet::applyToTemp(IndexedString fileName)
-{
- //If there is a temporary version already, then use that one
- IndexedString tempFile = tempNameForFile(fileName);
-
- if(!d->changes.contains(tempFile))
- return ChangeResult(i18n("Trying to apply changes to a temporary that is not in this change set: %1", fileName.str()));
-
- CodeRepresentation::Ptr repr = createCodeRepresentation(tempFile);
ChangeResult result(true);
- QList sortedChanges;
- QString newText;
+ foreach(const IndexedString &file, d->changes.keys())
{
- result = d->removeDuplicates(tempFile, sortedChanges);
- if(!result)
- return result;
+ CodeRepresentation::Ptr repr = createCodeRepresentation(file);
+
+ if(!repr)
+ continue;
- result = d->generateNewText(tempFile, sortedChanges, repr.data(), newText);
+ QList sortedChangesList;
+ result = d->removeDuplicates(file, sortedChangesList);
if(!result)
- return result;
- }
-
- //If a previous temp did not exist, create one
- if(!d->tempToOriginal.contains(tempFile))
- d->addTempFile(fileName, newText);
- else
- {
- result = d->replaceOldText(repr.data(), newText, sortedChanges);
- //On success the changes' documents should be changed to the original to prevent double application
- if(result)
- {
- IndexedString original = d->tempToOriginal[tempFile];
- d->changes.erase(d->changes.find(tempFile));
- foreach(DocumentChangePointer p, sortedChanges)
- {
- p->m_document = original;
- d->changes[original] << p;
- }
- }
- }
-
- return result;
-}
+ continue;
-
-DocumentChangeSet::ChangeResult DocumentChangeSet::applyAllToTemp()
-{
- QMap codeRepresentations;
- QMap newTexts;
- QMap > filteredSortedChanges;
-
- QList files(d->withoutOriginals());
-
- foreach(const IndexedString &file, files)
- {
- kDebug() << "Processing changes- for file: " << file.str();
- CodeRepresentation::Ptr repr = createCodeRepresentation(file);
- if(!repr)
- return ChangeResult(QString("Could not create a Representation for %1").arg(file.str()));
+ QString newText;
- codeRepresentations[file] = repr;
+ result = d->generateNewText(file, sortedChangesList, repr.data(), newText);
+ if(!result)
+ continue;
- QList& sortedChangesList(filteredSortedChanges[file]);
- {
- ChangeResult result(d->removeDuplicates(file, sortedChangesList));
- if(!result)
- return result;
- }
-
- {
- ChangeResult result(d->generateNewText(file, sortedChangesList, repr.data(), newTexts[file]));
- if(!result)
- return result;
- }
+ InsertArtificialCodeRepresentationPointer code( new InsertArtificialCodeRepresentation(IndexedString(file.toUrl().fileName()), newText) );
+ ret.insert(file, code);
}
- QMap oldTexts;
-
- //! @todo apply correct formatting, and call it
- //d->autoformatChanges()
-
- //Apply the changes to the files
- foreach(const IndexedString & file, files)
- {
- if(!d->tempToOriginal.contains(file))
- {
- kDebug() << "Adding a new Temp file from original with text: " << newTexts[file];
- d->addTempFile(file, newTexts[file]);
- }
- else
- {
- oldTexts[file] = codeRepresentations[file]->text();
- kDebug() << "Applying to already created temp: " << file.str() << ". Old text: " << oldTexts[file];
-
- DocumentChangeSet::ChangeResult result = d->replaceOldText(codeRepresentations[file].data(), newTexts[file], filteredSortedChanges[file]);
- if(!result && d->replacePolicy == StopOnFailedChange)
- {
- //Revert all files
- foreach(const IndexedString &revertFile, oldTexts.keys())
- codeRepresentations[revertFile]->setText(oldTexts[revertFile]);
-
- return result;
- }
-
- //On success the changes' documents should be changed to the original to prevent double application
- d->changes.erase(d->changes.find(file));
- foreach(DocumentChangePointer p, filteredSortedChanges[file])
- {
- p->m_document = d->tempToOriginal[file];
- d->changes[p->m_document] << p;
- }
-
- kDebug() << "Applied new text: " << newTexts[file];
- }
- }
-
- ModificationRevisionSet::clearCache();
-
- d->updateFiles();
-
- return DocumentChangeSet::ChangeResult(true);
+ return ret;
}
DocumentChangeSet::ChangeResult DocumentChangeSet::applyAllChanges() {
@@ -350,7 +176,7 @@
QMap > filteredSortedChanges;
ChangeResult result(true);
- QList files(d->withoutOriginals());
+ QList files(d->changes.keys());
foreach(const IndexedString &file, files)
{
@@ -360,7 +186,6 @@
codeRepresentations[file] = repr;
-
QList& sortedChangesList(filteredSortedChanges[file]);
{
result = d->removeDuplicates(file, sortedChangesList);
@@ -377,9 +202,6 @@
QMap oldTexts;
- //! @todo apply correct formatting, and call it
- //d->autoformatChanges()
-
//Apply the changes to the files
foreach(const IndexedString &file, files)
{
@@ -396,13 +218,15 @@
}
}
- result = d->replaceOriginalsWithTemps();
-
ModificationRevisionSet::clearCache();
d->updateFiles();
- return result;;
+ if(d->activationPolicy == Activate)
+ foreach(const IndexedString& file, files)
+ ICore::self()->documentController()->openDocument(file.toUrl());
+
+ return result;
}
DocumentChangeSet::ChangeResult DocumentChangeSetPrivate::replaceOldText(CodeRepresentation * repr,
@@ -444,7 +268,7 @@
//For files on disk
if (!repr->setText(newText))
{
- QString warningString = QString("Could not replace text for file in disk, or artificial code: %1").arg(sortedChangesList.begin()->data()->m_document.str());
+ QString warningString = QString("Could not replace text in the document: %1").arg(sortedChangesList.begin()->data()->m_document.str());
if(replacePolicy == DocumentChangeSet::WarnOnFailedChange)
{
kWarning() << warningString;
@@ -469,6 +293,8 @@
//Create the actual new modified file
QStringList textLines = repr->text().split('\n');
+ KMimeType::Ptr mime = KMimeType::findByUrl(file.toUrl());
+
for(int pos = sortedChanges.size()-1; pos >= 0; --pos) {
DocumentChange& change(*sortedChanges[pos]);
QString encountered;
@@ -482,7 +308,7 @@
QString rightContext = QStringList(textLines.mid(change.m_range.end.line)).join("\n").mid(change.m_range.end.column);
if(formatter && formatPolicy == DocumentChangeSet::AutoFormatChanges)
- change.m_newText = formatter->formatSource(change.m_newText, KMimeType::findByUrl(file.toUrl()), leftContext, rightContext);
+ change.m_newText = formatter->formatSource(change.m_newText, mime, leftContext, rightContext);
textLines[change.m_range.start.line].replace(change.m_range.start.column, change.m_range.end.column-change.m_range.start.column, change.m_newText);
}else{
@@ -562,8 +388,13 @@
if(updatePolicy != DocumentChangeSet::NoUpdate && ICore::self())
foreach(const IndexedString &file, changes.keys())
{
+ if(!file.toUrl().isValid()) {
+ kWarning() << "Trying to apply changes to an invalid document";
+ continue;
+ }
+
ICore::self()->languageController()->backgroundParser()->addDocument(file.toUrl());
- foreach(KUrl doc, ICore::self()->languageController()->backgroundParser()->managedDocuments()) {
+ foreach(const KUrl& doc, ICore::self()->languageController()->backgroundParser()->managedDocuments()) {
DUChainReadLocker lock(DUChain::lock());
TopDUContext* top = DUChainUtils::standardContextForUrl(doc);
if((top && top->parsingEnvironmentFile() && top->parsingEnvironmentFile()->needsUpdate()) || !top) {
@@ -574,231 +405,4 @@
}
}
-void DocumentChangeSetPrivate::formatChanges()
-{
-#if 0
- if(formatChanges() == DocumentChangeSet::AutoFormatChanges) {
- foreach(const IndexedString &file, d->changes.keys())
- {
- ISourceFormatter* formatter = ICore::self()->sourceFormatterController()->formatterForUrl(file.toUrl());
- if(!formatter)
- continue;
-
- filteredSortedChanges[file].clear(); //We create a new list of changes
-
- QStringList fileNewText = newTexts[file].split("\n");
-
- QList< SimpleRange > changes = changedRanges[file].keys();
- for(QList< SimpleRange >::const_iterator it = changes.end(); it != changes.begin(); ) {
- --it;
-
- QString leftContext = QStringList(fileNewText.mid(0, (*it).start.line+1)).join("\n");
- leftContext.chop((*it).start.column);
-
- QString text = fileNewText[(*it).start.line].mid((*it).start.column);
-
- if((*it).start.line == (*it).end.line)
- text = text.left((*it).end.column - (*it).start.column);
-
- QString rightContext = QStringList(fileNewText.mid((*it).end.line)).join("\n").mid((*it).end.column);
-
-
- /*
- --it;
- int end = *it+1;
- int start = *it;
-
- while(it != changes.begin() && *(it-1) == start-1) {
- --start;
- --it;
- }
-
- QString leftContext = QStringList(fileNewText.mid(0, start)).join("\n");
- QString sourceToFormat = QStringList(fileNewText.mid(start, end-start)).join("\n");
- QString rightContext = QStringList(fileNewText.mid(end)).join("\n");
- QString formattedSource = formatter->formatSource(sourceToFormat, KMimeType::findByUrl(file.toUrl()), leftContext + "\n", "\n" + rightContext);
-
- fileNewText.erase(fileNewText.begin()+start, fileNewText.begin()+end);
-
- int insertAt = start;
- foreach(QString insertString, formattedSource.split("\n")) {
- fileNewText.insert(insertAt, insertString);
- ++insertAt;
- }
-
- //Create new changes that replace the whole lines at the same time
- filteredSortedChanges[file].prepend(DocumentChangePointer(new DocumentChange(file, SimpleRange(start, 0, end, 0), sourceToFormat+"\n", formattedSource+"\n")));
- */}
-
- newTexts[file] = fileNewText.join("\n");
- }
- }
-#endif
-}
-
-void DocumentChangeSetPrivate::addFileToProject(IndexedString file)
-{
- Q_UNUSED(file);
- #if 0
- //Pick the folder Item that should contain the new class
- IProject * p;
- QList folderList = p->foldersForUrl(newClassWizard.implementationUrl().upUrl());
- if(folderList.isEmpty())
- return;
- ProjectFolderItem* folder = folderList.first();
-
- //Add new files into the project
- if(!item)
- item=folder;
- ProjectFileItem* projectFile=p->buildSystemManager()->addFile(newClassWizard.implementationUrl(), folder);
-
- //Add them as targets
- if(item->target()) {
- p->buildSystemManager()->addFileToTarget(file, item->target());
- p->buildSystemManager()->addFileToTarget(header, item->target());
- } else if(item->project()->buildSystemManager() &&
- item->project()->buildSystemManager()->features() & IBuildSystemManager::Targets) {
- QList t=folder->targetList();
-
- for(QStandardItem* it=folder; it && t.isEmpty(); it=it->parent()) {
- KDevelop::ProjectBaseItem* bit=static_cast(it);
- t=bit->targetList();
- }
-
- if(t.count()==1) //Just choose this one
- p->buildSystemManager()->addFileToTarget(file, t.first());
- else {
- KDialog d;
- QWidget *w=new QWidget(&d);
- w->setLayout(new QVBoxLayout);
- w->layout()->addWidget(new QLabel("Choose one target to add the file or cancel if you do not want to do so."));
- QListWidget* targetsWidget=new QListWidget(w);
- targetsWidget->setSelectionMode(QAbstractItemView::SingleSelection);
- foreach(ProjectTargetItem* it, t) {
- targetsWidget->addItem(it->text());
- }
- w->layout()->addWidget(targetsWidget);
-
- targetsWidget->setCurrentRow(0);
- d.setButtons( KDialog::Ok | KDialog::Cancel);
- d.enableButtonOk(true);
- d.setMainWidget(w);
-
- if(d.exec()==QDialog::Accepted) {
- if(targetsWidget->selectedItems().isEmpty())
- QMessageBox::warning(0, QString(), i18n("Did not select anything, not adding to a target."));
- else
- p->buildSystemManager()->addFileToTarget(file, t[targetsWidget->currentRow()]);
- }
- }
-}
-#endif
-}
-
-void DocumentChangeSetPrivate::addTempFile(IndexedString originalName, const QString & text)
-{
- QString name = originalName.str();
- KUrl url = CodeRepresentation::artificialUrl(name);
-
- unsigned int counter = 0;
- //Search for a unique new url for this file
- while(artificialCodeRepresentationExists(IndexedString(url)))
- {
- //Increment a number reference before the period
- name.insert(name.lastIndexOf("."), QString::number(counter++));
- url = CodeRepresentation::artificialUrl(name);
- }
-
- IndexedString tempFile(url);
-
- tempFiles[originalName] = qMakePair(tempFile, InsertArtificialCodeRepresentationPointer(new InsertArtificialCodeRepresentation(tempFile, text)));
- tempToOriginal[tempFile] = originalName;
- changes.erase(changes.find(tempFile));
-}
-
-void DocumentChangeSetPrivate::adjustChangeToTemp(DocumentChangePointer newChange)
-{
-
- kDebug() << "Adjusting change to temp for change: " << newChange->m_newText << "With range: " << newChange->m_range.textRange();
- //Adjust the range of the new change according to temporaries already applied
-
- //Sort the changes to the original file
- QList sortedChanges;
- removeDuplicates(newChange->m_document, sortedChanges );
- std::reverse(sortedChanges.begin(), sortedChanges.end());
-
- foreach(DocumentChangePointer originalChange, sortedChanges)
- {
- if(originalChange->m_range.textRange() < newChange->m_range.textRange() )
- {
- if(originalChange->m_range.end.line == newChange->m_range.start.line)
- {
- //Apply column offset
- int offset;
- if(originalChange->m_newText.count('\n'))
- offset = originalChange->m_range.start.column - (originalChange->m_newText.lastIndexOf('\n') - originalChange->m_newText.size() + 1);
- else
- offset = originalChange->m_newText.size() - (originalChange->m_range.end.column - originalChange->m_range.start.column);
- newChange->m_range.start.column += offset;
- newChange->m_range.end.column += offset;
- }
-
- //Get the line difference that the change poduced, and apply it to the new one
- int lineDifference = originalChange->m_newText.count('\n') - originalChange->m_range.textRange().numberOfLines();
- if(lineDifference)
- {
- newChange->m_range.start.line += lineDifference;
- newChange->m_range.end.line += lineDifference;
- }
- }
- }
- newChange->m_document = tempFiles[newChange->m_document].first;
-
- kDebug() << "New range: " << newChange->m_range.textRange();
-}
-
-// Return a list of the files that are logically unapplied changes
-QList DocumentChangeSetPrivate::withoutOriginals()
-{
- QList files(changes.keys());
- QList::iterator it = files.begin();
- while(it != files.end())
- {
- if(tempFiles.contains(*it))
- it = files.erase(it);
- else
- ++it;
- }
-
- return files;
-}
-
-//Replace original files with temporaries
-DocumentChangeSet::ChangeResult DocumentChangeSetPrivate::replaceOriginalsWithTemps()
-{
- //These two are helpers for backtracking changes in case an error replacing text is encountered
- QMap oldText;
- QMap originalRepresentations;
-
- QMap< IndexedString, TempPair >::iterator it = tempFiles.begin();
-
- while(it != tempFiles.end())
- {
- CodeRepresentation::Ptr original = originalRepresentations[it.key()] = createCodeRepresentation(it.key());
- oldText[it.key()] = original->text();
- CodeRepresentation::Ptr temp = createCodeRepresentation(it->first);
-
- if(!original->setText(temp->text()))
- {
- foreach(const IndexedString & file, originalRepresentations.keys())
- originalRepresentations[file]->setText(oldText[file]);
-
- return DocumentChangeSet::ChangeResult(QString("Error trying to write changes to file: %1").arg(it.key().str()));
- }
- ++it;
- }
-
- return true;
-}
-
}
diff -Nru kdevplatform-0.9.98/language/codegen/documentchangeset.h kdevplatform-1.0.1/language/codegen/documentchangeset.h
--- kdevplatform-0.9.98/language/codegen/documentchangeset.h 2009-09-05 23:45:58.000000000 +0100
+++ kdevplatform-1.0.1/language/codegen/documentchangeset.h 2010-07-17 19:58:27.000000000 +0100
@@ -23,6 +23,7 @@
#include
#include
#include
+#include "coderepresentation.h"
namespace KDevelop {
@@ -49,13 +50,16 @@
typedef KSharedPtr DocumentChangePointer;
+/**
+ * Object representing an arbitrary set of changes to an arbitrary set of files that can be applied atomically.
+ */
class KDEVPLATFORMLANGUAGE_EXPORT DocumentChangeSet {
public:
- DocumentChangeSet();
- DocumentChangeSet(const DocumentChangeSet & rhs);
- ~DocumentChangeSet();
- DocumentChangeSet& operator=(const DocumentChangeSet& rhs);
+ DocumentChangeSet();
+ ~DocumentChangeSet();
+ DocumentChangeSet(const DocumentChangeSet & rhs);
+ DocumentChangeSet& operator=(const DocumentChangeSet& rhs);
//Returns true on success
struct ChangeResult {
@@ -76,55 +80,51 @@
///If the change has multiple lines, a problem will be returned. these don't work at he moment.
ChangeResult addChange(const DocumentChange& change);
- ///Get rid of all the current changes
- void clear();
-
- ///Merge two document change sets
- DocumentChangeSet & operator<<(DocumentChangeSet &);
+ ChangeResult addChange(DocumentChangePointer change);
enum ReplacementPolicy {
IgnoreFailedChange,///If this is given, all changes that could not be applied are simply ignored
WarnOnFailedChange,///If this is given to applyAllChanges, a warning is given when a change could not be applied,
///but following changes are applied, and success is returned.
- StopOnFailedChange ///If this is given to applyAllChanges, then all replacements are reverted and an error returned on problems
+ StopOnFailedChange ///If this is given to applyAllChanges, then all replacements are reverted and an error returned on problems (default)
};
+
///@param policy What should be done when a change could not be applied?
void setReplacementPolicy(ReplacementPolicy policy);
enum FormatPolicy {
NoAutoFormat, ///If this option is given, no automatic formatting is applied
- AutoFormatChanges ///If this option is given, all changes are automatically reformatted using the formatter plugin for the mime type
+ AutoFormatChanges ///If this option is given, all changes are automatically reformatted using the formatter plugin for the mime type (default)
};
+
///@param policy How the changed text should be formatted
void setFormatPolicy(FormatPolicy policy);
enum DUChainUpdateHandling {
NoUpdate, ///No updates will be scheduled
- SimpleUpdate ///The changed documents will be added to the background parser, plus all documents that are currently open and recursively import those documetns
+ SimpleUpdate ///The changed documents will be added to the background parser, plus all documents that are currently open and recursively import those documents (default)
//FullUpdate ///All documents in all open projects that recursively import any of the changed documents will be updated
};
+
///@param policy Whether a duchain update should be triggered for all affected documents
void setUpdateHandling(DUChainUpdateHandling policy);
- ///Apply all the registered changes for @p file, and keep them as temporary in memory
- ///@note For multiple passes if the original file is given, then the previous temporary will be merged
- ChangeResult applyToTemp(IndexedString file);
-
- ///Apply all changes for all files, and keep them as temporary in memory
- ChangeResult applyAllToTemp();
+ enum ActivationPolicy {
+ Activate, ///The affected files will be activated
+ DoNotActivate ///The affected files will not be activated (default)
+ };
- /// @return The name for the latest temporary version of @p file if it exists, returns @p file otherwise
- IndexedString tempNameForFile(IndexedString file) const;
+ ///@param policy Whether the affected documents should be activated when the change is applied
+ void setActivationPolicy(ActivationPolicy policy);
- /// @return The mapping between all original file names and their temporaries
- /// @note If a file has not been applied to temp, it won't appear in the mapping
- QMap tempNamesForAll() const;
+ ///Applies all changes to temporary code representations, and returns a map from each file-name to
+ ///the respective inserted artificial code-representation.
+ QMap temporaryCodeRepresentations() const;
- /// Apply all the changes registered in this changeset
+ /// Apply all the changes registered in this changeset to the actual files
ChangeResult applyAllChanges();
private:
-
DocumentChangeSetPrivate * d;
};
}
diff -Nru kdevplatform-0.9.98/language/codegen/licenses/LGPL v2 kdevplatform-1.0.1/language/codegen/licenses/LGPL v2
--- kdevplatform-0.9.98/language/codegen/licenses/LGPL v2 2010-01-18 21:37:46.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/licenses/LGPL v2 2010-07-17 19:58:27.000000000 +0100
@@ -1,13 +1,16 @@
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
+
+ Copyright (C)
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
\ No newline at end of file
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
diff -Nru kdevplatform-0.9.98/language/codegen/overridespage.cpp kdevplatform-1.0.1/language/codegen/overridespage.cpp
--- kdevplatform-0.9.98/language/codegen/overridespage.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/codegen/overridespage.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -194,7 +194,7 @@
classItem->insertChild(0, overrideItem);
}
- d->declarationMap[overrideItem] = DeclarationPointer(childDeclaration);
+ d->declarationMap[overrideItem] = childDeclaration;
}
QTreeWidget* OverridesPage::overrideTree() const
diff -Nru kdevplatform-0.9.98/language/codegen/utilities.cpp kdevplatform-1.0.1/language/codegen/utilities.cpp
--- kdevplatform-0.9.98/language/codegen/utilities.cpp 2009-12-15 17:05:09.000000000 +0000
+++ kdevplatform-1.0.1/language/codegen/utilities.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -90,7 +90,7 @@
}
QMultiMap sorter;
- foreach(IndexedString file, implementationsInFile.keys())
+ foreach(const IndexedString& file, implementationsInFile.keys())
sorter.insert(implementationsInFile[file], file);
QList sortedFiles = sorter.values();
@@ -110,7 +110,7 @@
IndexedString mostUsesFile;
unsigned int mostUses = 0;
- foreach(IndexedString currentFile, tiedFiles)
+ foreach(const IndexedString& currentFile, tiedFiles)
if(static_cast(uses[currentFile].size()) > mostUses)
{
mostUses = uses[currentFile].size();
diff -Nru kdevplatform-0.9.98/language/duchain/appendedlist.h kdevplatform-1.0.1/language/duchain/appendedlist.h
--- kdevplatform-0.9.98/language/duchain/appendedlist.h 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/appendedlist.h 2010-07-17 19:58:27.000000000 +0100
@@ -197,18 +197,26 @@
///Foreach macro that takes a container and a function-name, and will iterate through the vector returned by that function, using the length returned by the function-name with "Size" appended.
//This might be a little slow
-#define FOREACH_FUNCTION(item, container) for(uint a = 0, mustDo = 1, containerSize = container ## Size(); a < containerSize; ++a) if((mustDo == 0 || mustDo == 1) && (mustDo = 2)) for(item(container()[a]); mustDo; mustDo = 0)
+#define FOREACH_FUNCTION(item, container) \
+ for(uint a = 0, mustDo = 1, containerSize = container ## Size(); a < containerSize; ++a) \
+ if((mustDo == 0 || mustDo == 1) && (mustDo = 2)) \
+ for(item(container()[a]); mustDo; mustDo = 0)
//More efficient version that does not repeatedly call functions on the container, but the syntax is a bit less nice
-// #define FOREACH_FUNCTION_EFFICIENT(itemType, itemName, container) for(itemType* start = container(), end = start + container ## Size(), fake = start; start != end; ++start) for( itemType itemName(*start); fake != end; fake = end)
+/*
+#define FOREACH_FUNCTION_EFFICIENT(itemType, itemName, container) \
+ for(itemType* start = container(), end = start + container ## Size(), fake = start; start != end; ++start) \
+ for( itemType itemName(*start); fake != end; fake = end)
+*/
#define DEFINE_LIST_MEMBER_HASH(container, member, type) \
- typedef TemporaryDataManager > temporaryHash ## container ## member ## Type; \
+ typedef KDevelop::TemporaryDataManager > temporaryHash ## container ## member ## Type; \
K_GLOBAL_STATIC_WITH_ARGS(temporaryHash ## container ## member ## Type, temporaryHash ## container ## member ## Static, ( #container "::" #member )) \
temporaryHash ## container ## member ## Type& temporaryHash ## container ## member() { \
return *temporaryHash ## container ## member ## Static; \
}
-#define DECLARE_LIST_MEMBER_HASH(container, member, type) KDevelop::TemporaryDataManager >& temporaryHash ## container ## member();
+#define DECLARE_LIST_MEMBER_HASH(container, member, type) \
+ KDevelop::TemporaryDataManager >& temporaryHash ## container ## member();
///This implements the interfaces so this container can be used as a predecessor for classes with appended lists.
///You should do this within the abstract base class that opens a tree of classes that can have appended lists,
@@ -217,31 +225,31 @@
///You can call appendedListsDynamic() to find out whether the item is marked as dynamic.
///When this item is used, the same rules have to be followed as for a class with appended lists: You have to call
///initializeAppendedLists(...) and freeAppendedLists(..)
-///Also, when you use this, you have to implement a size_t classSize() function, that returns the size of the class including derived classes,
+///Also, when you use this, you have to implement a uint classSize() function, that returns the size of the class including derived classes,
///but not including the dynamic data. Optionally you can implement a static bool appendedListDynamicDefault() function, that returns the default-value for the "dynamic" parameter.
///to initializeAppendedLists.
#define APPENDED_LISTS_STUB(container) \
-bool m_dynamic : 1; \
-unsigned int offsetBehindLastList() const { return 0; } \
-size_t dynamicSize() const { return classSize(); } \
-template bool listsEqual(const T& /*rhs*/) const { return true; } \
-template void copyAllFrom(const T& /*rhs*/) const { } \
-void initializeAppendedLists(bool dynamic = appendedListDynamicDefault()) { m_dynamic = dynamic; } \
-void freeAppendedLists() { } \
-bool appendedListsDynamic() const { return m_dynamic; }
+ bool m_dynamic : 1; \
+ unsigned int offsetBehindLastList() const { return 0; } \
+ uint dynamicSize() const { return classSize(); } \
+ template bool listsEqual(const T& /*rhs*/) const { return true; } \
+ template void copyAllFrom(const T& /*rhs*/) const { } \
+ void initializeAppendedLists(bool dynamic = appendedListDynamicDefault()) { m_dynamic = dynamic; } \
+ void freeAppendedLists() { } \
+ bool appendedListsDynamic() const { return m_dynamic; }
///use this if the class does not have a base class that also uses appended lists
#define START_APPENDED_LISTS(container) \
-unsigned int offsetBehindBase() const { return 0; } \
-void freeDynamicData() { freeAppendedLists(); }
+ unsigned int offsetBehindBase() const { return 0; } \
+ void freeDynamicData() { freeAppendedLists(); }
///Use this if one of the base-classes of the container also has the appended lists interfaces implemented.
///To reduce the probability of future problems, you should give the direct base class this one inherits from.
///@note: Multiple inheritance is not supported, however it will work ok if only one of the base-classes uses appended lists.
#define START_APPENDED_LISTS_BASE(container, base) \
-unsigned int offsetBehindBase() const { return base :: offsetBehindLastList(); } \
-void freeDynamicData() { freeAppendedLists(); base::freeDynamicData(); }
+ unsigned int offsetBehindBase() const { return base :: offsetBehindLastList(); } \
+ void freeDynamicData() { freeAppendedLists(); base::freeDynamicData(); }
#define APPENDED_LIST_COMMON(container, type, name) \
@@ -268,40 +276,69 @@
new (curr) type(*otherCurr); /* Call the copy constructors */ \
}\
} \
- void name ## NeedDynamicList() { Q_ASSERT(appendedListsDynamic()); if((name ## Data & KDevelop::DynamicAppendedListRevertMask) == 0) { name ## Data = temporaryHash ## container ## name().alloc(); Q_ASSERT(temporaryHash ## container ## name().getItem(name ## Data).isEmpty()); } } \
+ void name ## NeedDynamicList() { \
+ Q_ASSERT(appendedListsDynamic()); \
+ if((name ## Data & KDevelop::DynamicAppendedListRevertMask) == 0) {\
+ name ## Data = temporaryHash ## container ## name().alloc();\
+ Q_ASSERT(temporaryHash ## container ## name().getItem(name ## Data).isEmpty()); \
+ } \
+ } \
void name ## Initialize(bool dynamic) { name ## Data = (dynamic ? KDevelop::DynamicAppendedListMask : 0); } \
- void name ## Free() { if(appendedListsDynamic()) { if(name ## Data & KDevelop::DynamicAppendedListRevertMask) temporaryHash ## container ## name().free(name ## Data); } else { type* curr = const_cast(name()); type* end = curr + name ## Size(); for(; curr < end; ++curr) curr->~type(); /*call destructors*/ } } \
+ void name ## Free() { \
+ if(appendedListsDynamic()) { \
+ if(name ## Data & KDevelop::DynamicAppendedListRevertMask) temporaryHash ## container ## name().free(name ## Data);\
+ } else { \
+ type* curr = const_cast(name()); \
+ type* end = curr + name ## Size(); \
+ for(; curr < end; ++curr) curr->~type(); /*call destructors*/ \
+ } \
+ } \
///@todo Make these things a bit faster(less recursion)
-#define APPENDED_LIST_FIRST(container, type, name) APPENDED_LIST_COMMON(container, type, name) \
- const type* name() const { if((name ## Data & KDevelop::DynamicAppendedListRevertMask) == 0) return 0; if(!appendedListsDynamic()) return (type*)(((char*)this) + classSize() + offsetBehindBase()); else return temporaryHash ## container ## name().getItem(name ## Data).data(); } \
- unsigned int name ## OffsetBehind() const { return name ## Size() * sizeof(type) + offsetBehindBase(); } \
- template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs); } \
- template void name ## CopyAllFrom( const T& rhs ) { name ## CopyFrom(rhs); } \
- void name ## InitializeChain(bool dynamic) { name ## Initialize(dynamic); } \
- void name ## FreeChain() { name ## Free(); }
-
-#define APPENDED_LIST(container, type, name, predecessor) APPENDED_LIST_COMMON(container, type, name) \
- const type* name() const {if((name ## Data & KDevelop::DynamicAppendedListRevertMask) == 0) return 0; if(!appendedListsDynamic()) return (type*)(((char*)this) + classSize() + predecessor ## OffsetBehind()); else return temporaryHash ## container ## name().getItem(name ## Data).data(); } \
- unsigned int name ## OffsetBehind() const { return name ## Size() * sizeof(type) + predecessor ## OffsetBehind(); } \
- template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs) && predecessor ## ListChainEquals(rhs); } \
- template void name ## CopyAllFrom( const T& rhs ) { predecessor ## CopyAllFrom(rhs); name ## CopyFrom(rhs); } \
- void name ## InitializeChain(bool dynamic) { name ## Initialize(dynamic); predecessor ## InitializeChain(dynamic); } \
- void name ## FreeChain() { name ## Free(); predecessor ## FreeChain(); }
-
-#define END_APPENDED_LISTS(container, predecessor) /* Returns the size of the object containing the appended lists, including them */ \
- unsigned int completeSize() const { return classSize() + predecessor ## OffsetBehind(); } \
- /* Compares all local appended lists(not from base classes) and returns true if they are equal */ \
- template bool listsEqual(const T& rhs) const { return predecessor ## ListChainEquals(rhs); } \
- /* Copies all the local appended lists(not from base classes) from the given item.*/ \
- template void copyListsFrom(const T& rhs) { return predecessor ## CopyAllFrom(rhs); } \
- void initializeAppendedLists(bool dynamic = appendedListDynamicDefault()) { predecessor ## Data = (dynamic ? KDevelop::DynamicAppendedListMask : 0); predecessor ## InitializeChain(dynamic); } \
- void freeAppendedLists() { predecessor ## FreeChain(); } \
- bool appendedListsDynamic() const { return predecessor ## Data & KDevelop::DynamicAppendedListMask; } \
- unsigned int offsetBehindLastList() const { return predecessor ## OffsetBehind(); } \
- size_t dynamicSize() const { return offsetBehindLastList() + classSize(); }
+#define APPENDED_LIST_FIRST(container, type, name) \
+ APPENDED_LIST_COMMON(container, type, name) \
+ const type* name() const { \
+ if((name ## Data & KDevelop::DynamicAppendedListRevertMask) == 0) return 0; \
+ if(!appendedListsDynamic()) return (type*)(((char*)this) + classSize() + offsetBehindBase()); \
+ else return temporaryHash ## container ## name().getItem(name ## Data).data(); \
+ } \
+ unsigned int name ## OffsetBehind() const { return name ## Size() * sizeof(type) + offsetBehindBase(); } \
+ template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs); } \
+ template void name ## CopyAllFrom( const T& rhs ) { name ## CopyFrom(rhs); } \
+ void name ## InitializeChain(bool dynamic) { name ## Initialize(dynamic); } \
+ void name ## FreeChain() { name ## Free(); }
+
+#define APPENDED_LIST(container, type, name, predecessor) \
+ APPENDED_LIST_COMMON(container, type, name) \
+ const type* name() const {\
+ if((name ## Data & KDevelop::DynamicAppendedListRevertMask) == 0) return 0; \
+ if(!appendedListsDynamic()) return (type*)(((char*)this) + classSize() + predecessor ## OffsetBehind()); \
+ else return temporaryHash ## container ## name().getItem(name ## Data).data(); \
+ } \
+ unsigned int name ## OffsetBehind() const { return name ## Size() * sizeof(type) + predecessor ## OffsetBehind(); } \
+ template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs) && predecessor ## ListChainEquals(rhs); } \
+ template void name ## CopyAllFrom( const T& rhs ) { predecessor ## CopyAllFrom(rhs); name ## CopyFrom(rhs); } \
+ void name ## InitializeChain(bool dynamic) { name ## Initialize(dynamic); predecessor ## InitializeChain(dynamic); } \
+ void name ## FreeChain() { name ## Free(); predecessor ## FreeChain(); }
+
+#define END_APPENDED_LISTS(container, predecessor) \
+ /* Returns the size of the object containing the appended lists, including them */ \
+ unsigned int completeSize() const { return classSize() + predecessor ## OffsetBehind(); } \
+ /* Compares all local appended lists(not from base classes) and returns true if they are equal */ \
+ template bool listsEqual(const T& rhs) const { return predecessor ## ListChainEquals(rhs); } \
+ /* Copies all the local appended lists(not from base classes) from the given item.*/ \
+ template void copyListsFrom(const T& rhs) { return predecessor ## CopyAllFrom(rhs); } \
+ void initializeAppendedLists(bool dynamic = appendedListDynamicDefault()) { \
+ predecessor ## Data = (dynamic ? KDevelop::DynamicAppendedListMask : 0); \
+ predecessor ## InitializeChain(dynamic); \
+ } \
+ void freeAppendedLists() { predecessor ## FreeChain(); } \
+ bool appendedListsDynamic() const { return predecessor ## Data & KDevelop::DynamicAppendedListMask; } \
+ unsigned int offsetBehindLastList() const { return predecessor ## OffsetBehind(); } \
+ uint dynamicSize() const { return offsetBehindLastList() + classSize(); }
+
/**
* This is a class that allows you easily putting instances of your class into an ItemRepository as seen in itemrepository.h.
* All your class needs to do is:
@@ -329,7 +366,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.dynamicSize();
}
diff -Nru kdevplatform-0.9.98/language/duchain/appendedlist_static.h kdevplatform-1.0.1/language/duchain/appendedlist_static.h
--- kdevplatform-0.9.98/language/duchain/appendedlist_static.h 2009-12-15 14:02:00.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/appendedlist_static.h 2010-07-17 19:58:27.000000000 +0100
@@ -43,37 +43,48 @@
// Foreach macro that takes a container and a function-name, and will iterate through the vector returned by that function, using the length returned by the function-name with "Size" appended.
//This might be a little slow
-#define FOREACH_FUNCTION(item, container) for(uint a = 0, mustDo = 1; a < container ## Size(); ++a) if((mustDo == 0 || mustDo == 1) && (mustDo = 2)) for(item(container()[a]); mustDo; mustDo = 0)
+#define FOREACH_FUNCTION(item, container) \
+ for(uint a = 0, mustDo = 1; a < container ## Size(); ++a) \
+ if((mustDo == 0 || mustDo == 1) && (mustDo = 2)) \
+ for(item(container()[a]); mustDo; mustDo = 0)
#define START_APPENDED_LISTS(selftype) typedef selftype SelfType;
#define APPENDED_LIST_COMMON(type, name) \
KDevelop::AppendedList name ## List; \
unsigned int name ## Size() const { return name ## List.size(); } \
- template bool name ## Equals(const T& rhs) const { unsigned int size = name ## Size(); if(size != rhs.name ## Size()) return false; for(uint a = 0; a < size; ++a) {if(!(name()[a] == rhs.name()[a])) return false;} return true; }
+ template bool name ## Equals(const T& rhs) const { \
+ unsigned int size = name ## Size(); \
+ if(size != rhs.name ## Size()) return false; \
+ for(uint a = 0; a < size; ++a) {if(!(name()[a] == rhs.name()[a])) return false;} \
+ return true; \
+ }
///@todo Make these things a bit faster(less recursion)
-#define APPENDED_LIST_FIRST(type, name) APPENDED_LIST_COMMON(type, name) \
- const type* name() const { return name ## List.data( ((char*)this) + sizeof(SelfType) ); } \
- unsigned int name ## OffsetBehind() const { return name ## List.dynamicDataSize(); } \
- template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs); } \
- template void name ## CopyAllFrom( const T& rhs ) { name ## List.copy(const_cast(name()), rhs.name(), rhs.name ## Size()); }
-
-#define APPENDED_LIST(type, name, predecessor) APPENDED_LIST_COMMON(type, name) \
- const type* name() const { return name ## List.data( ((char*)this) + sizeof(SelfType) + predecessor ## OffsetBehind() ); } \
- unsigned int name ## OffsetBehind() const { return name ## List.dynamicDataSize() + predecessor ## OffsetBehind(); } \
- template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs) && predecessor ## ListChainEquals(rhs); } \
- template void name ## CopyAllFrom( const T& rhs ) { name ## List.copy(const_cast(name()), rhs.name(), rhs.name ## Size()); predecessor ## CopyAllFrom(); }
-
-#define END_APPENDED_LISTS(predecessor) /* Returns the size of the object containing the appended lists, including them */ \
- unsigned int completeSize() const { return sizeof(SelfType) + predecessor ## OffsetBehind(); } \
- unsigned int lastOffsetBehind() const { return predecessor ## OffsetBehind(); } \
- /* Compares all appended lists and returns true if they are equal */ \
- template bool listsEqual(const T& rhs) const { return predecessor ## ListChainEquals(rhs); } \
- template void copyListsFrom(const T& rhs) { return predecessor ## CopyAllFrom(rhs); }
+#define APPENDED_LIST_FIRST(type, name) \
+ APPENDED_LIST_COMMON(type, name) \
+ const type* name() const { return name ## List.data( ((char*)this) + sizeof(SelfType) ); } \
+ unsigned int name ## OffsetBehind() const { return name ## List.dynamicDataSize(); } \
+ template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs); } \
+ template void name ## CopyAllFrom( const T& rhs ) { name ## List.copy(const_cast(name()), rhs.name(), rhs.name ## Size()); }
+
+#define APPENDED_LIST(type, name, predecessor) \
+ APPENDED_LIST_COMMON(type, name) \
+ const type* name() const { return name ## List.data( ((char*)this) + sizeof(SelfType) + predecessor ## OffsetBehind() ); } \
+ unsigned int name ## OffsetBehind() const { return name ## List.dynamicDataSize() + predecessor ## OffsetBehind(); } \
+ template bool name ## ListChainEquals( const T& rhs ) const { return name ## Equals(rhs) && predecessor ## ListChainEquals(rhs); } \
+ template void name ## CopyAllFrom( const T& rhs ) { name ## List.copy(const_cast(name()), rhs.name(), rhs.name ## Size()); predecessor ## CopyAllFrom(); }
+
+#define END_APPENDED_LISTS(predecessor) \
+ /* Returns the size of the object containing the appended lists, including them */ \
+ unsigned int completeSize() const { return sizeof(SelfType) + predecessor ## OffsetBehind(); } \
+ unsigned int lastOffsetBehind() const { return predecessor ## OffsetBehind(); } \
+ /* Compares all appended lists and returns true if they are equal */ \
+ template bool listsEqual(const T& rhs) const { return predecessor ## ListChainEquals(rhs); } \
+ template void copyListsFrom(const T& rhs) { return predecessor ## CopyAllFrom(rhs); }
- template
+template
class AppendedList : public KDevVarLengthArray {
public:
unsigned int dynamicDataSize() const {
diff -Nru kdevplatform-0.9.98/language/duchain/arrayhelpers.h kdevplatform-1.0.1/language/duchain/arrayhelpers.h
--- kdevplatform-0.9.98/language/duchain/arrayhelpers.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/arrayhelpers.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,86 +0,0 @@
-/*
- Copyright 2008 David Nolden
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef ARRAYHELPERS_H
-#define ARRAYHELPERS_H
-
-#include
-#include
-
-//Foreach macro that also works with KDevVarLengthArray
-#define FOREACH_ARRAY(item, container) for(int a = 0, mustDo = 1; a < container.size(); ++a) if((mustDo == 0 || mustDo == 1) && (mustDo = 2)) for(item(container[a]); mustDo; mustDo = 0)
-
-namespace KDevelop {
-
-template
-QList arrayToList(const KDevVarLengthArray& array) {
- QList ret;
- FOREACH_ARRAY(const T& item, array)
- ret << item;
-
- return ret;
-}
-
-template
-QList arrayToVector(const KDevVarLengthArray& array) {
- QVector ret;
- FOREACH_ARRAY(const T& item, array)
- ret << item;
-
- return ret;
-}
-
-template
-bool arrayContains(Container& container, const Type& value) {
- for(int a = 0; a < container.size(); ++a)
- if(container[a] == value)
- return true;
-
- return false;
-}
-template
-void insertToArray(Container& array, const Type& item, int position) {
- Q_ASSERT(position >= 0 && position <= array.size());
- array.resize(array.size()+1);
- for(int a = array.size()-1; a > position; --a) {
- array[a] = array[a-1];
- }
- array[position] = item;
-}
-
-template
-void removeFromArray(Container& array, int position) {
- Q_ASSERT(position >= 0 && position < array.size());
- for(int a = position; a < array.size()-1; ++a) {
- array[a] = array[a+1];
- }
- array.resize(array.size()-1);
-}
-
-template
-bool removeOne(Container& container, const Type& value) {
- for(int a = 0; a < container.size(); ++a) {
- if(container[a] == value) {
- removeFromArray(container, a);
- return true;
- }
- }
- return false;
-}
-}
-#endif
diff -Nru kdevplatform-0.9.98/language/duchain/builders/abstractcontextbuilder.h kdevplatform-1.0.1/language/duchain/builders/abstractcontextbuilder.h
--- kdevplatform-0.9.98/language/duchain/builders/abstractcontextbuilder.h 2009-12-16 19:56:49.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/builders/abstractcontextbuilder.h 2010-07-17 19:58:27.000000000 +0100
@@ -140,12 +140,14 @@
}else
{
// kDebug() << "compiling";
- LockedSmartInterface iface = m_editor->smart();
- top = newTopContext( iface.currentDocument()
- ? SimpleRange( iface.currentDocument()->documentRange() )
- : SimpleRange( SimpleCursor( 0, 0 ), SimpleCursor( INT_MAX, INT_MAX ) ) );
- top->setSmartRange( m_editor->topRange( iface, EditorIntegrator::DefinitionUseChain ), DocumentRangeObject::Own );
- top->setType( DUContext::Global );
+ {
+ LockedSmartInterface iface = m_editor->smart();
+ top = newTopContext( iface.currentDocument()
+ ? SimpleRange( iface.currentDocument()->documentRange() )
+ : SimpleRange( SimpleCursor( 0, 0 ), SimpleCursor( INT_MAX, INT_MAX ) ) );
+ top->setSmartRange( m_editor->topRange( iface, EditorIntegrator::DefinitionUseChain ), DocumentRangeObject::Own );
+ top->setType( DUContext::Global );
+ }
DUChain::self()->addDocumentChain( top );
}
setEncountered( top );
diff -Nru kdevplatform-0.9.98/language/duchain/classdeclaration.cpp kdevplatform-1.0.1/language/duchain/classdeclaration.cpp
--- kdevplatform-0.9.98/language/duchain/classdeclaration.cpp 2010-01-16 14:29:03.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/classdeclaration.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -50,7 +50,10 @@
REGISTER_DUCHAIN_ITEM(ClassDeclaration);
void ClassDeclaration::clearBaseClasses() {
+ bool wasInSymbolTable = inSymbolTable();
+ setInSymbolTable(false);
d_func_dynamic()->baseClassesList().clear();
+ setInSymbolTable(wasInSymbolTable);
}
uint ClassDeclaration::baseClassesSize() const {
@@ -62,12 +65,18 @@
}
void ClassDeclaration::addBaseClass(BaseClassInstance klass) {
+ bool wasInSymbolTable = inSymbolTable();
+ setInSymbolTable(false);
d_func_dynamic()->baseClassesList().append(klass);
+ setInSymbolTable(wasInSymbolTable);
}
void ClassDeclaration::replaceBaseClass(uint n, BaseClassInstance klass) {
Q_ASSERT(n <= d_func()->baseClassesSize());
+ bool wasInSymbolTable = inSymbolTable();
+ setInSymbolTable(false);
d_func_dynamic()->baseClassesList()[n] = klass;
+ setInSymbolTable(wasInSymbolTable);
}
ClassDeclaration::~ClassDeclaration()
diff -Nru kdevplatform-0.9.98/language/duchain/codemodel.cpp kdevplatform-1.0.1/language/duchain/codemodel.cpp
--- kdevplatform-0.9.98/language/duchain/codemodel.cpp 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/codemodel.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -93,7 +93,7 @@
return file.index();
}
- size_t itemSize() const {
+ uint itemSize() const {
return dynamicSize();
}
@@ -122,7 +122,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.itemSize();
}
diff -Nru kdevplatform-0.9.98/language/duchain/codemodel.h kdevplatform-1.0.1/language/duchain/codemodel.h
--- kdevplatform-0.9.98/language/duchain/codemodel.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/codemodel.h 2010-07-17 19:58:27.000000000 +0100
@@ -40,7 +40,8 @@
Variable = 2,
Class = 4,
ForwardDeclaration = 8,
- Namespace = 16
+ Namespace = 16,
+ ClassMember = 32
};
IndexedQualifiedIdentifier id;
uint referenceCount;
diff -Nru kdevplatform-0.9.98/language/duchain/declaration.cpp kdevplatform-1.0.1/language/duchain/declaration.cpp
--- kdevplatform-0.9.98/language/duchain/declaration.cpp 2009-12-13 15:29:13.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/declaration.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -634,6 +634,9 @@
if(decl->isForwardDeclaration())
kind = (CodeModelItem::Kind)(kind | CodeModelItem::ForwardDeclaration);
+ if ( decl->context() && decl->context()->type() == DUContext::Class )
+ kind = (CodeModelItem::Kind)(kind | CodeModelItem::ClassMember);
+
return kind;
}
@@ -729,7 +732,7 @@
KDevVarLengthArray useContexts = DUChain::uses()->uses(id());
- FOREACH_ARRAY(IndexedTopDUContext indexedContext, useContexts) {
+ FOREACH_ARRAY(const IndexedTopDUContext& indexedContext, useContexts) {
if(!indexedContext.isLoaded())
continue;
TopDUContext* context = indexedContext.data();
@@ -756,7 +759,7 @@
KDevVarLengthArray useContexts = DUChain::uses()->uses(id());
- FOREACH_ARRAY(IndexedTopDUContext indexedContext, useContexts) {
+ FOREACH_ARRAY(const IndexedTopDUContext& indexedContext, useContexts) {
TopDUContext* context = indexedContext.data();
if(context) {
QMap& ranges(tempUses[context->url()]);
diff -Nru kdevplatform-0.9.98/language/duchain/declarationid.cpp kdevplatform-1.0.1/language/duchain/declarationid.cpp
--- kdevplatform-0.9.98/language/duchain/declarationid.cpp 2009-12-10 02:04:51.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/declarationid.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -23,7 +23,6 @@
#include "duchain.h"
#include "declaration.h"
#include "persistentsymboltable.h"
-#include "arrayhelpers.h"
#include "instantiationinformation.h"
#include
diff -Nru kdevplatform-0.9.98/language/duchain/definitions.cpp kdevplatform-1.0.1/language/duchain/definitions.cpp
--- kdevplatform-0.9.98/language/duchain/definitions.cpp 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/definitions.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -76,7 +76,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.itemSize();
}
@@ -180,7 +180,7 @@
if(index) {
const DefinitionsItem* repositoryItem = d->m_definitions.itemFromIndex(index);
- FOREACH_FUNCTION(IndexedDeclaration decl, repositoryItem->definitions)
+ FOREACH_FUNCTION(const IndexedDeclaration& decl, repositoryItem->definitions)
ret.append(decl);
}
diff -Nru kdevplatform-0.9.98/language/duchain/duchain.cpp kdevplatform-1.0.1/language/duchain/duchain.cpp
--- kdevplatform-0.9.98/language/duchain/duchain.cpp 2010-01-20 00:11:08.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/duchain.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -120,7 +120,7 @@
struct ItemRepositoryIndexHash
{
- size_t
+ uint
operator()(unsigned int __x) const
{ return 173*(__x>>2) + 11 * (__x >> 16); }
};
@@ -144,7 +144,7 @@
return m_index;
}
- size_t itemSize() const {
+ uint itemSize() const {
return sizeof(EnvironmentInformationItem) + DUChainItemSystem::self().dynamicSize(*m_file->d_func());
}
@@ -234,7 +234,7 @@
return m_file.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item->itemSize();
}
@@ -1552,7 +1552,7 @@
//This is not exactly right, as the direct imports don't necessarily equal the real imports used by uses
//but it approximates the correct behavior.
bool allImportsLoaded = true;
- foreach(DUContext::Import import, standardContext->importedParentContexts())
+ foreach(const DUContext::Import& import, standardContext->importedParentContexts())
if(!import.indexedContext().indexedTopContext().isLoaded())
allImportsLoaded = false;
diff -Nru kdevplatform-0.9.98/language/duchain/duchain.h kdevplatform-1.0.1/language/duchain/duchain.h
--- kdevplatform-0.9.98/language/duchain/duchain.h 2010-01-20 00:11:08.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/duchain.h 2010-07-17 19:58:27.000000000 +0100
@@ -74,9 +74,10 @@
* @param notifyReady An optional pointer to a QObject that should contain a slot
* "void updateReady(KDevelop::IndexedString url, KDevelop::ReferencedTopDUContext topContext)".
* The notification is guaranteed to be called once for each call to updateContextForUrl. The given top-context
- * may be invalid if the update failed. A queued connection is used if a re-parse has to be done.
+ * may be invalid if the update failed. A queued connection is used if a re-parse has to be done. The duchain
+ * will _not_ be locked when updateReady is called.
* @param priority An optional priority for the job. The lower the value, the higher it's priority.
- * @note The duchain must be at least read-locked locked when this is called!
+ * @note The duchain must _not_ be locked when this is called!
*/
Q_SCRIPTABLE void updateContextForUrl(const IndexedString& document, TopDUContext::Features minFeatures, QObject* notifyReady = 0, int priority = 1) const;
diff -Nru kdevplatform-0.9.98/language/duchain/duchainlock.cpp kdevplatform-1.0.1/language/duchain/duchainlock.cpp
--- kdevplatform-0.9.98/language/duchain/duchainlock.cpp 2009-12-14 23:20:19.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/duchainlock.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -24,6 +24,9 @@
#include
#include
+///@todo Always prefer exactly that lock that is requested by the thread that has the foreground mutex,
+/// to reduce the amount of UI blocking.
+
//Nanoseconds to sleep when waiting for a lock
const uint uSleepTime = 500;
diff -Nru kdevplatform-0.9.98/language/duchain/duchainregister.cpp kdevplatform-1.0.1/language/duchain/duchainregister.cpp
--- kdevplatform-0.9.98/language/duchain/duchainregister.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/duchainregister.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -53,7 +53,7 @@
return m_factories[data.classId]->dynamicSize(data);
}
-size_t DUChainItemSystem::dataClassSize(const DUChainBaseData& data) const {
+uint DUChainItemSystem::dataClassSize(const DUChainBaseData& data) const {
if(uint(m_dataClassSizes.size()) <= data.classId || m_dataClassSizes[data.classId] == 0)
return 0;
return m_dataClassSizes[data.classId];
diff -Nru kdevplatform-0.9.98/language/duchain/duchainregister.h kdevplatform-1.0.1/language/duchain/duchainregister.h
--- kdevplatform-0.9.98/language/duchain/duchainregister.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/duchainregister.h 2010-07-17 19:58:27.000000000 +0100
@@ -136,7 +136,7 @@
///Returns the size of the derived class, not including dynamic data.
///Returns zero if the class is not known.
- size_t dataClassSize(const DUChainBaseData& data) const;
+ uint dataClassSize(const DUChainBaseData& data) const;
///Calls the destructor, but does not delete anything. This is needed because the data classes must not contain virtual members.
///This should only be called when a duchain data-pointer is semantically deleted, eg. when it does not persist on disk.
@@ -151,7 +151,7 @@
private:
QVector m_factories;
- QVector m_dataClassSizes;
+ QVector m_dataClassSizes;
};
/// Helper class to register an DUChainBase subclass.
diff -Nru kdevplatform-0.9.98/language/duchain/duchainutils.cpp kdevplatform-1.0.1/language/duchain/duchainutils.cpp
--- kdevplatform-0.9.98/language/duchain/duchainutils.cpp 2009-12-09 21:28:30.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/duchainutils.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -119,10 +119,15 @@
break;
case AbstractType::TypeAbstract:
case AbstractType::TypeDelayed:
+ case AbstractType::TypeUnsure:
+ case AbstractType::TypeAlias:
// TODO
break;
}
+ if( dec->abstractType()->modifiers() & AbstractType::ConstModifier )
+ p |= CodeCompletionModel::Const;
+
if( dec->kind() == Declaration::Instance && !dec->isFunctionDeclaration() )
p |= CodeCompletionModel::Variable;
}
@@ -423,7 +428,7 @@
return ret;
if(decl->internalContext() && decl->internalContext()->type() == DUContext::Class)
- FOREACH_ARRAY(IndexedDUContext importer, decl->internalContext()->indexedImporters()) {
+ FOREACH_ARRAY(const IndexedDUContext& importer, decl->internalContext()->indexedImporters()) {
DUContext* imp = importer.data();
@@ -540,7 +545,7 @@
DUContext* DUChainUtils::getFunctionContext(Declaration* decl) {
DUContext* functionContext = decl->internalContext();
if(functionContext && functionContext->type() != DUContext::Function) {
- foreach(DUContext::Import import, functionContext->importedParentContexts()) {
+ foreach(const DUContext::Import& import, functionContext->importedParentContexts()) {
DUContext* ctx = import.context(decl->topContext());
if(ctx && ctx->type() == DUContext::Function)
functionContext = ctx;
diff -Nru kdevplatform-0.9.98/language/duchain/ducontext.cpp kdevplatform-1.0.1/language/duchain/ducontext.cpp
--- kdevplatform-0.9.98/language/duchain/ducontext.cpp 2010-01-16 13:40:55.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/ducontext.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -43,7 +43,6 @@
#include "indexedstring.h"
#include "duchainregister.h"
#include "topducontextdynamicdata.h"
-#include "arrayhelpers.h"
#include "importers.h"
///It is fine to use one global static mutex here
@@ -288,7 +287,7 @@
{
m_hasLocalDeclarationsHash = true;
- FOREACH_FUNCTION(LocalIndexedDeclaration indexedDecl, ctx->d_func()->m_localDeclarations) {
+ FOREACH_FUNCTION(const LocalIndexedDeclaration& indexedDecl, ctx->d_func()->m_localDeclarations) {
Declaration* decl = indexedDecl.data(m_topContext);
Q_ASSERT(decl);
if(currentDecl != decl)
@@ -297,7 +296,7 @@
m_localDeclarationsHash.insert( currentIdentifier, DeclarationPointer(decl) );
}
- FOREACH_FUNCTION(LocalIndexedDUContext child, ctx->d_func()->m_childContexts) {
+ FOREACH_FUNCTION(const LocalIndexedDUContext& child, ctx->d_func()->m_childContexts) {
DUContext* childCtx = child.data(m_topContext);
Q_ASSERT(childCtx);
if(childCtx->d_func()->m_propagateDeclarations)
@@ -324,7 +323,7 @@
uint propagatingChildContexts = 0;
- FOREACH_FUNCTION(LocalIndexedDUContext child, m_context->d_func()->m_childContexts) {
+ FOREACH_FUNCTION(const LocalIndexedDUContext& child, m_context->d_func()->m_childContexts) {
DUContext* childCtx = child.data(m_topContext);
Q_ASSERT(childCtx);
if(childCtx->d_func()->m_propagateDeclarations)
@@ -387,7 +386,7 @@
if(child == newDeclaration)
return;
if (start > child->range().start) {
- insertToArray(m_context->d_func_dynamic()->m_localDeclarationsList(), newDeclaration, i+1);
+ m_context->d_func_dynamic()->m_localDeclarationsList().insert(i+1, newDeclaration);
if(!m_context->d_func()->m_localDeclarations()[i+1].data(m_topContext))
kFatal() << "Inserted a not addressable declaration";
@@ -396,7 +395,7 @@
}
}
if( !inserted ) //We haven't found any child that is before this one, so prepend it
- insertToArray(m_context->d_func_dynamic()->m_localDeclarationsList(), newDeclaration, 0);
+ m_context->d_func_dynamic()->m_localDeclarationsList().insert(0, newDeclaration);
addDeclarationToHash(newDeclaration->identifier(), newDeclaration);
}
@@ -411,7 +410,7 @@
if(!m_topContext->deleting()) //We can save a lot of time by just not caring about the hash while deleting
removeDeclarationFromHash(declaration->identifier(), declaration);
- if( removeOne(m_context->d_func_dynamic()->m_localDeclarationsList(), LocalIndexedDeclaration(declaration)) ) {
+ if( m_context->d_func_dynamic()->m_localDeclarationsList().removeOne(LocalIndexedDeclaration(declaration)) ) {
//DUChain::contextChanged(m_context, DUChainObserver::Removal, DUChainObserver::LocalDeclarations, declaration);
return true;
}else {
@@ -450,7 +449,7 @@
if (context == child)
return;
if (context->range().start >= child->range().start) {
- insertToArray(m_context->d_func_dynamic()->m_childContextsList(), indexed, i+1);
+ m_context->d_func_dynamic()->m_childContextsList().insert(i+1, indexed);
context->m_dynamicData->m_parentContext = m_context;
inserted = true;
break;
@@ -458,7 +457,7 @@
}
if( !inserted ) {
- m_context->d_func_dynamic()->m_childContextsList().insert(indexed, 0);
+ m_context->d_func_dynamic()->m_childContextsList().insert(0, indexed);
context->m_dynamicData->m_parentContext = m_context;
}
@@ -475,7 +474,7 @@
bool DUContextDynamicData::removeChildContext( DUContext* context ) {
// ENSURE_CAN_WRITE
- if( removeOne(m_context->d_func_dynamic()->m_childContextsList(), LocalIndexedDUContext(context)) )
+ if( m_context->d_func_dynamic()->m_childContextsList().removeOne(LocalIndexedDUContext(context)) )
return true;
else
return false;
@@ -488,7 +487,7 @@
if(import.isDirect()) {
//Direct importers are registered directly within the data
- if(arrayContains(m_context->d_func_dynamic()->m_importersList(), IndexedDUContext(context))) {
+ if(m_context->d_func_dynamic()->m_importersList().contains(IndexedDUContext(context))) {
kDebug(9505) << m_context->scopeIdentifier(true).toString() << "importer added multiple times:" << context->scopeIdentifier(true).toString();
return;
}
@@ -509,7 +508,7 @@
DUContext::Import import(m_context, context);
if(import.isDirect()) {
- removeOne(m_context->d_func_dynamic()->m_importersList(), IndexedDUContext(context));
+ m_context->d_func_dynamic()->m_importersList().removeOne(IndexedDUContext(context));
}else{
//Indirect importers are registered separately
Importers::self().removeImporter(import.indirectDeclarationId(), IndexedDUContext(context));
@@ -594,10 +593,6 @@
if(!top->deleting() || !top->isOnDisk()) {
DUCHAIN_D_DYNAMIC(DUContext);
- QualifiedIdentifier id(scopeIdentifier(true));
- if(d->m_inSymbolTable && parentContext()) {
- PersistentSymbolTable::self().removeContext(id, this);
- }
if(d->m_owner.declaration())
d->m_owner.declaration()->setInternalContext(0);
@@ -642,7 +637,7 @@
ENSURE_CAN_READ
QVector< DUContext * > ret;
- FOREACH_FUNCTION(LocalIndexedDUContext ctx, d_func()->m_childContexts)
+ FOREACH_FUNCTION(const LocalIndexedDUContext& ctx, d_func()->m_childContexts)
ret << ctx.data(topContext());
return ret;
}
@@ -708,7 +703,7 @@
DeclarationList ret;
findLocalDeclarationsInternal(identifier, position.isValid() ? position : range().end, dataType, ret, topContext ? topContext : this->topContext(), flags);
- return arrayToList(ret);
+ return ret.toList();
}
bool contextIsChildOrEqual(const DUContext* childContext, const DUContext* context) {
@@ -723,7 +718,6 @@
void DUContext::findLocalDeclarationsInternal( const Identifier& identifier, const SimpleCursor & position, const AbstractType::Ptr& dataType, DeclarationList& ret, const TopDUContext* /*source*/, SearchFlags flags ) const
{
- IndexedIdentifier indexedIdentifier(identifier);
{
QMutexLocker lock(&DUContextDynamicData::m_localDeclarationsMutex);
@@ -805,6 +799,7 @@
}else {
//Iterate through all declarations
DUContextDynamicData::VisibleDeclarationIterator it(m_dynamicData);
+ IndexedIdentifier indexedIdentifier(identifier);
while(it) {
Declaration* declaration = *it;
if(declaration->indexedIdentifier() == indexedIdentifier) {
@@ -912,7 +907,7 @@
}
QList ret;
- FOREACH_ARRAY(SearchItem::Ptr item, identifiers)
+ FOREACH_ARRAY(const SearchItem::Ptr& item, identifiers)
ret += item->toList();
return ret;
@@ -928,7 +923,7 @@
findDeclarationsInternal(identifiers, position.isValid() ? position : range().end, dataType, ret, topContext ? topContext : this->topContext(), flags, 0);
- return arrayToList(ret);
+ return ret.toList();
}
bool DUContext::imports(const DUContext* origin, const SimpleCursor& /*position*/ ) const
@@ -985,7 +980,7 @@
for(unsigned int a = 0; a < d->m_importedContextsSize(); ++a) {
if(d->m_importedContexts()[a] == import) {
- removeFromArray(d->m_importedContextsList(), a);
+ d->m_importedContextsList().remove(a);
break;
}
}
@@ -1004,7 +999,7 @@
if(owner())
ret = Importers::self().importers(owner()->id()); //Add indirect importers to the list
- FOREACH_FUNCTION(IndexedDUContext ctx, d_func()->m_importers)
+ FOREACH_FUNCTION(const IndexedDUContext& ctx, d_func()->m_importers)
ret.append(ctx);
return ret;
@@ -1015,13 +1010,13 @@
ENSURE_CAN_READ
QVector ret;
- FOREACH_FUNCTION(IndexedDUContext ctx, d_func()->m_importers)
+ FOREACH_FUNCTION(const IndexedDUContext& ctx, d_func()->m_importers)
ret << ctx.context();
if(owner()) {
//Add indirect importers to the list
KDevVarLengthArray indirect = Importers::self().importers(owner()->id());
- FOREACH_ARRAY(IndexedDUContext ctx, indirect) {
+ FOREACH_ARRAY(const IndexedDUContext& ctx, indirect) {
ret << ctx.context();
}
}
@@ -1036,7 +1031,7 @@
if (!parent)
parent = const_cast(this);
- FOREACH_FUNCTION(LocalIndexedDUContext context, parent->d_func()->m_childContexts)
+ FOREACH_FUNCTION(const LocalIndexedDUContext& context, parent->d_func()->m_childContexts)
if (context.data(topContext())->range().contains(position)) {
DUContext* ret = findContext(position, context.data(topContext()));
if (!ret)
@@ -1053,7 +1048,7 @@
if (this == context)
return true;
- FOREACH_FUNCTION(LocalIndexedDUContext child, d_func()->m_childContexts) {
+ FOREACH_FUNCTION(const LocalIndexedDUContext& child, d_func()->m_childContexts) {
if (child.data(topContext())->parentContextOf(context))
return true;
}
@@ -1081,7 +1076,7 @@
QMutexLocker lock(&DUContextDynamicData::m_localDeclarationsMutex);
QVector ret;
- FOREACH_FUNCTION(LocalIndexedDeclaration decl, d_func()->m_localDeclarations) {
+ FOREACH_FUNCTION(const LocalIndexedDeclaration& decl, d_func()->m_localDeclarations) {
ret << decl.data(topContext());
}
@@ -1159,7 +1154,7 @@
TopDUContext* top = topContext();
//If we are deleting something that is not stored to disk, we need to create + delete the declarations,
//so their destructor unregisters from the persistent symbol table and from TopDUContextDynamicData
- FOREACH_ARRAY(LocalIndexedDeclaration decl, declarations)
+ FOREACH_ARRAY(const LocalIndexedDeclaration& decl, declarations)
if(decl.isLoaded(top) || !top->deleting() || !top->isOnDisk())
delete decl.data(top);
}
@@ -1171,7 +1166,7 @@
TopDUContext* top = topContext();
QVector children;
- FOREACH_FUNCTION(LocalIndexedDUContext ctx, d_func()->m_childContexts)
+ FOREACH_FUNCTION(const LocalIndexedDUContext& ctx, d_func()->m_childContexts)
children << ctx;
//If we are deleting a context that is already stored to disk, we don't need to load not yet loaded child-contexts.
@@ -1266,14 +1261,14 @@
SearchItem::PtrList identifiers;
identifiers << SearchItem::Ptr(new SearchItem(QualifiedIdentifier(identifier)));
findDeclarationsInternal(identifiers, position.isValid() ? position : range().end, AbstractType::Ptr(), ret, topContext ? topContext : this->topContext(), flags, 0);
- return arrayToList(ret);
+ return ret.toList();
}
void DUContext::deleteUse(int index)
{
ENSURE_CAN_WRITE
DUCHAIN_D_DYNAMIC(DUContext);
- removeFromArray(d->m_usesList(), index);
+ d->m_usesList().remove(index);
if(!m_dynamicData->m_rangesForUses.isEmpty()) {
if(m_dynamicData->m_rangesForUses[index]) {
@@ -1322,7 +1317,7 @@
{
deleteUses();
- FOREACH_FUNCTION(LocalIndexedDUContext childContext, d_func()->m_childContexts)
+ FOREACH_FUNCTION(const LocalIndexedDUContext& childContext, d_func()->m_childContexts)
childContext.data(topContext())->deleteUsesRecursively();
}
@@ -1360,18 +1355,6 @@
return ret;
}
-QList DUContext::findContexts(ContextType contextType, const QualifiedIdentifier& identifier, const SimpleCursor& position, const TopDUContext* top, SearchFlags flags) const
-{
- ENSURE_CAN_READ
-
- QList ret;
- SearchItem::PtrList identifiers;
- identifiers << SearchItem::Ptr(new SearchItem(identifier));
-
- findContextsInternal(contextType, identifiers, position.isValid() ? position : range().end, ret, top ? top : topContext(), flags);
- return ret;
-}
-
void DUContext::applyAliases(const SearchItem::PtrList& baseIdentifiers, SearchItem::PtrList& identifiers, const SimpleCursor& position, bool canBeNamespace, bool onlyImports) const {
DeclarationList imports;
@@ -1393,9 +1376,13 @@
FOREACH_ARRAY( Declaration* importDecl, imports )
{
//Search for the identifier with the import-identifier prepended
- Q_ASSERT(dynamic_cast(importDecl));
- NamespaceAliasDeclaration* alias = static_cast(importDecl);
- identifiers.append( SearchItem::Ptr( new SearchItem( alias->importIdentifier(), identifier ) ) ) ;
+ if(dynamic_cast(importDecl))
+ {
+ NamespaceAliasDeclaration* alias = static_cast(importDecl);
+ identifiers.append( SearchItem::Ptr( new SearchItem( alias->importIdentifier(), identifier ) ) ) ;
+ }else{
+ kDebug() << "Declaration with namespace alias identifier has the wrong type" << importDecl->url().str() << importDecl->range().textRange();
+ }
}
}
@@ -1450,62 +1437,11 @@
}
newItem->isExplicitlyGlobal = true;
- insertToArray(identifiers, newItem, 0);
+ identifiers.insert(0, newItem);
}
}
}
-void DUContext::findContextsInternal(ContextType contextType, const SearchItem::PtrList& baseIdentifiers, const SimpleCursor& position, QList& ret, const TopDUContext* source, SearchFlags flags) const
-{
- DUCHAIN_D(DUContext);
- if (contextType == type()) {
- FOREACH_ARRAY( const SearchItem::Ptr& identifier, baseIdentifiers )
- if (identifier->match(scopeIdentifier(true)) && (!parentContext() || !identifier->isExplicitlyGlobal) )
- ret.append(const_cast(this));
- }
- ///@todo This doesn't seem quite correct: Local Contexts aren't found anywhere
- ///Step 1: Apply namespace-aliases and -imports
- SearchItem::PtrList aliasedIdentifiers;
- //Because of namespace-imports and aliases, this identifier may need to be searched as under multiple names
- applyAliases(baseIdentifiers, aliasedIdentifiers, position, contextType == Namespace, contextType != Namespace);
-
- if( d->m_importedContextsSize() != 0 ) {
- ///Step 2: Give identifiers that are not marked as explicitly-global to imported contexts(explicitly global ones are treatead in TopDUContext)
- SearchItem::PtrList nonGlobalIdentifiers;
- FOREACH_ARRAY( const SearchItem::Ptr& identifier, aliasedIdentifiers )
- if( !identifier->isExplicitlyGlobal )
- nonGlobalIdentifiers << identifier;
-
- if( !nonGlobalIdentifiers.isEmpty() ) {
- for(int a = d->m_importedContextsSize()-1; a >= 0; --a) {
-
- DUContext* context = d->m_importedContexts()[a].context(source);
-
- while( !context && a > 0 ) {
- --a;
- context = d->m_importedContexts()[a].context(source);
- }
-
- if(context == this) {
- kDebug() << "resolved self as import:" << scopeIdentifier(true);
- continue;
- }
-
- if( !context )
- break;
-
- context->findContextsInternal(contextType, nonGlobalIdentifiers, url() == context->url() ? position : context->range().end, ret, source, flags | InImportedParentContext);
- }
- }
- }
-
- ///Step 3: Continue search in parent
- if ( !(flags & DontSearchInParent) && shouldSearchInParent(flags) && parentContext()) {
- applyUpwardsAliases(aliasedIdentifiers, source);
- parentContext()->findContextsInternal(contextType, aliasedIdentifiers, url() == parentContext()->url() ? position : parentContext()->range().end, ret, source, flags);
- }
-}
-
bool DUContext::shouldSearchInParent(SearchFlags flags) const
{
return (parentContext() && parentContext()->type() == DUContext::Helper && (flags & InImportedParentContext)) ||
@@ -1525,20 +1461,33 @@
return d_func()->m_usesSize();
}
+bool usesRangeLessThan(const Use& left, const Use& right)
+{
+ return left.m_range.start < right.m_range.start;
+}
+
int DUContext::createUse(int declarationIndex, const SimpleRange& range, KTextEditor::SmartRange* smartRange, int insertBefore)
{
DUCHAIN_D_DYNAMIC(DUContext);
ENSURE_CAN_WRITE
+ Use use(range, declarationIndex);
if(insertBefore == -1) {
//Find position where to insert
+ const unsigned int size = d->m_usesSize();
+ const Use* uses = d->m_uses();
+ const Use* lowerBound = qLowerBound(uses, uses + size, use, usesRangeLessThan);
+ insertBefore = lowerBound - uses;
+ // comment out to test this:
+ /*
unsigned int a = 0;
- for(; a < d->m_usesSize() && range.start > d->m_uses()[a].m_range.start; ++a) { ///@todo do binary search
+ for(; a < size && range.start > uses[a].m_range.start; ++a) {
}
- insertBefore = a;
+ Q_ASSERT(a == insertBefore);
+ */
}
- insertToArray(d->m_usesList(), Use(range, declarationIndex), insertBefore);
+ d->m_usesList().insert(insertBefore, use);
if(smartRange) {
///When this assertion triggers, then the updated context probably was not smart-converted before processing. @see SmartConverter
Q_ASSERT(uint(m_dynamicData->m_rangesForUses.size()) == d->m_usesSize()-1);
@@ -1644,7 +1593,7 @@
if (!range().contains(position))
return 0;
- FOREACH_FUNCTION(LocalIndexedDeclaration child, d_func()->m_localDeclarations)
+ FOREACH_FUNCTION(const LocalIndexedDeclaration& child, d_func()->m_localDeclarations)
if (child.data(topContext())->range().contains(position))
return child.data(topContext());
@@ -1658,7 +1607,7 @@
if (!this->range().contains(range))
return 0;
- FOREACH_FUNCTION(LocalIndexedDUContext child, d_func()->m_childContexts)
+ FOREACH_FUNCTION(const LocalIndexedDUContext& child, d_func()->m_childContexts)
if (DUContext* specific = child.data(topContext())->findContextIncluding(range))
return specific;
@@ -1688,17 +1637,6 @@
void DUContext::setInSymbolTable(bool inSymbolTable)
{
- if(parentContext()) {
- if(!d_func()->m_inSymbolTable && inSymbolTable) {
- QualifiedIdentifier id(scopeIdentifier(true));
- PersistentSymbolTable::self().addContext(id, this);
-
- }else if(d_func()->m_inSymbolTable && !inSymbolTable) {
- QualifiedIdentifier id(scopeIdentifier(true));
- PersistentSymbolTable::self().removeContext(id, this);
- }
- }
-
d_func_dynamic()->m_inSymbolTable = inSymbolTable;
}
@@ -1729,7 +1667,7 @@
//Copy since the array may change during the iteration
KDevVarLengthArray childrenCopy = d_func_dynamic()->m_childContextsList();
- FOREACH_ARRAY(LocalIndexedDUContext childContext, childrenCopy)
+ FOREACH_ARRAY(const LocalIndexedDUContext& childContext, childrenCopy)
if (!encountered.contains(childContext.data(topContext())))
delete childContext.data(topContext());
}
@@ -1749,7 +1687,7 @@
if(!m_dynamicData->m_rangesForUses.isEmpty())
m_dynamicData->m_rangesForUses.squeeze();
- FOREACH_FUNCTION(LocalIndexedDUContext child, d_func()->m_childContexts)
+ FOREACH_FUNCTION(const LocalIndexedDUContext& child, d_func()->m_childContexts)
child.data(topContext())->squeeze();
}
@@ -1887,7 +1825,7 @@
void DUContext::SearchItem::addToEachNode(SearchItem::PtrList other) {
int added = 0;
- FOREACH_ARRAY(SearchItem::Ptr o, other) {
+ FOREACH_ARRAY(const SearchItem::Ptr& o, other) {
if(!o->isExplicitlyGlobal) {
next.append(o);
++added;
diff -Nru kdevplatform-0.9.98/language/duchain/ducontext.h kdevplatform-1.0.1/language/duchain/ducontext.h
--- kdevplatform-0.9.98/language/duchain/ducontext.h 2009-12-15 17:05:09.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/ducontext.h 2010-07-17 19:58:27.000000000 +0100
@@ -36,6 +36,9 @@
class QWidget;
+///@todo Move the complete handling of smart-ranges out of here, so that the duchain is independent of the editor.
+/// Use the foreground-lock instead of the smart-lock everywhere.
+
namespace KTextEditor {
class SmartRange;
}
@@ -257,7 +260,9 @@
DirectQualifiedLookup = 16 /**< When this flag is used, the searched qualified identifier should NOT be split up into it's components and looked up one by one. Currently only plays a role in C++ specific parts. */,
NoFiltering = 32 /**< Should be set when no filtering at all is wished, not even filtering that is natural for the underlying language(For example in C++, constructors are filtered out be default) */,
OnlyFunctions = 64 /**< When this is given, only function-declarations are returned. In case of C++, this also means that constructors can be retrieved, while normally they are filtered out. */,
- NoImportsCheck = 128 /**< With this parameter, a global search will return all matching items, from all contexts, not only from imported ones. */
+ NoImportsCheck = 128 /**< With this parameter, a global search will return all matching items, from all contexts, not only from imported ones. */,
+ NoSelfLookUp = 256 /**< With this parameter, the special-treatment during search that allows finding the context-class by its name is disabled. */,
+ LastSearchFlag = 512
};
Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
@@ -555,21 +560,6 @@
DUContext* findContext(const SimpleCursor& position, DUContext* parent = 0) const;
/**
- * Searches for the context with the given \a type and \a identifier.
- *
- * \param contextType type of context to locate; usually Namespace or Class.
- * \param identifier identifier of the context which is being searched for.
- * \param position cursor position to search from, or invalid to search the whole context.
- *
- * \returns the requested context if one was found, otherwise null.
- *
- * \warning this may return contexts which are not in this tree, you may need to lock them too...
- * \warning this function is not as far developed as findDeclarations(..), and does not respect all of the details
- * so always use findDeclarations(..) instead when possible!
- */
- QList findContexts(ContextType contextType, const QualifiedIdentifier& identifier, const SimpleCursor& position = SimpleCursor::invalid(), const TopDUContext* source = 0, SearchFlags flags = NoSearchFlags) const;
-
- /**
* Iterates the tree to see if the provided \a context is a subcontext of this context.
* \returns true if \a context is a subcontext, otherwise false.
*/
@@ -803,9 +793,6 @@
virtual void findLocalDeclarationsInternal( const Identifier& identifier, const SimpleCursor & position, const AbstractType::Ptr& dataType, DeclarationList& ret, const TopDUContext* source, SearchFlags flags ) const;
- /// Context search implementation
- virtual void findContextsInternal(ContextType contextType, const SearchItem::PtrList& identifiers, const SimpleCursor& position, QList& ret, const TopDUContext* source, SearchFlags flags = NoSearchFlags) const;
-
/**Applies namespace-imports and namespace-aliases and returns possible absolute identifiers that need to be searched.
* @param targetIdentifiers will be filled with all identifiers that should be searched for, instead of identifier.
* @param onlyImports if this is true, namespace-aliases will not be respected, but only imports. This is faster.
@@ -840,9 +827,10 @@
friend class IndexedDUContext;
friend class LocalIndexedDUContext;
friend class TopDUContextDynamicData;
+
void synchronizeUsesFromSmart() const;
void synchronizeUsesToSmart() const;
-
+
void clearDeclarationIndices();
void updateDeclarationIndices();
diff -Nru kdevplatform-0.9.98/language/duchain/functiondefinition.cpp kdevplatform-1.0.1/language/duchain/functiondefinition.cpp
--- kdevplatform-0.9.98/language/duchain/functiondefinition.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/functiondefinition.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -81,7 +81,7 @@
{
ENSURE_CHAIN_READ_LOCKED
KDevVarLengthArray allDefinitions = DUChain::definitions()->definitions(decl->id());
- FOREACH_ARRAY(IndexedDeclaration decl, allDefinitions) {
+ FOREACH_ARRAY(const IndexedDeclaration& decl, allDefinitions) {
if(decl.data()) ///@todo Find better ways of deciding which definition to use
return dynamic_cast(decl.data());
}
diff -Nru kdevplatform-0.9.98/language/duchain/identifier.cpp kdevplatform-1.0.1/language/duchain/identifier.cpp
--- kdevplatform-0.9.98/language/duchain/identifier.cpp 2009-12-09 20:06:53.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/identifier.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -76,7 +76,7 @@
//this must stay thread-safe(may be called by multiple threads at a time)
//The thread-safety is given because all threads will have the same result, and it will only be written once at the end.
uint hash = m_identifier.hash();
- FOREACH_FUNCTION(IndexedTypeIdentifier templateIdentifier, templateIdentifiers)
+ FOREACH_FUNCTION(const IndexedTypeIdentifier& templateIdentifier, templateIdentifiers)
hash = hash * 13 + IndexedTypeIdentifier(templateIdentifier).hash();
hash += m_unique;
m_hash = hash;
@@ -209,7 +209,7 @@
if( m_hash == 0 )
{
uint mhash = 0;
- FOREACH_FUNCTION( IndexedIdentifier identifier, identifiers )
+ FOREACH_FUNCTION( const IndexedIdentifier& identifier, identifiers )
mhash = 11*mhash + Identifier(identifier).hash();
if(mhash != m_hash)
@@ -592,10 +592,10 @@
ret.append(QString());
if(m_index) {
- FOREACH_FUNCTION(IndexedIdentifier index, cd->identifiers)
+ FOREACH_FUNCTION(const IndexedIdentifier& index, cd->identifiers)
ret << index.identifier().toString();
}else{
- FOREACH_FUNCTION(IndexedIdentifier index, dd->identifiers)
+ FOREACH_FUNCTION(const IndexedIdentifier& index, dd->identifiers)
ret << index.identifier().toString();
}
@@ -610,7 +610,7 @@
bool first = true;
if(m_index) {
- FOREACH_FUNCTION(IndexedIdentifier index, cd->identifiers)
+ FOREACH_FUNCTION(const IndexedIdentifier& index, cd->identifiers)
{
if( !first )
ret += "::";
@@ -620,7 +620,7 @@
ret += index.identifier().toString();
}
}else{
- FOREACH_FUNCTION(IndexedIdentifier index, dd->identifiers)
+ FOREACH_FUNCTION(const IndexedIdentifier& index, dd->identifiers)
{
if( !first )
ret += "::";
@@ -1136,7 +1136,7 @@
}
IndexedQualifiedIdentifier::IndexedQualifiedIdentifier() : index(emptyConstantQualifiedIdentifierPrivateIndex()) {
- ifDebug( kDebug() << "(" << ++cnt << ")" << m_id << identifier().toString() << index; )
+ ifDebug( kDebug() << "(" << ++cnt << ")" << identifier().toString() << index; )
if(shouldDoDUChainReferenceCounting(this)) {
ifDebug( kDebug() << "increasing"; )
@@ -1148,7 +1148,7 @@
}
IndexedQualifiedIdentifier::IndexedQualifiedIdentifier(const QualifiedIdentifier& id) : index(id.index()) {
- ifDebug( kDebug() << "(" << ++cnt << ")" << m_id << identifier().toString() << index; )
+ ifDebug( kDebug() << "(" << ++cnt << ")" << identifier().toString() << index; )
if(shouldDoDUChainReferenceCounting(this)) {
ifDebug( kDebug() << "increasing"; )
@@ -1158,7 +1158,7 @@
}
IndexedQualifiedIdentifier::IndexedQualifiedIdentifier(const IndexedQualifiedIdentifier& id) : index(id.index) {
- ifDebug( kDebug() << "(" << ++cnt << ")" << m_id << identifier().toString() << index; )
+ ifDebug( kDebug() << "(" << ++cnt << ")" << identifier().toString() << index; )
if(shouldDoDUChainReferenceCounting(this)) {
ifDebug( kDebug() << "increasing"; )
@@ -1169,7 +1169,7 @@
}
IndexedQualifiedIdentifier& IndexedQualifiedIdentifier::operator=(const QualifiedIdentifier& id) {
- ifDebug( kDebug() << "(" << ++cnt << ")" << m_id << identifier().toString() << index; )
+ ifDebug( kDebug() << "(" << ++cnt << ")" << identifier().toString() << index; )
if(shouldDoDUChainReferenceCounting(this)) {
QMutexLocker lock(qualifiedidentifierRepository->mutex());
@@ -1190,7 +1190,7 @@
IndexedQualifiedIdentifier& IndexedQualifiedIdentifier::operator=(const IndexedQualifiedIdentifier& rhs) {
- ifDebug( kDebug() << "(" << ++cnt << ")" << m_id << identifier().toString() << index; )
+ ifDebug( kDebug() << "(" << ++cnt << ")" << identifier().toString() << index; )
if(shouldDoDUChainReferenceCounting(this)) {
QMutexLocker lock(qualifiedidentifierRepository->mutex());
@@ -1210,7 +1210,7 @@
}
IndexedQualifiedIdentifier::~IndexedQualifiedIdentifier() {
- ifDebug( kDebug() << "(" << ++cnt << ")" << m_id << identifier().toString() << index; )
+ ifDebug( kDebug() << "(" << ++cnt << ")" << identifier().toString() << index; )
if(shouldDoDUChainReferenceCounting(this)) {
ifDebug( kDebug() << index << "decreasing"; )
QMutexLocker lock(qualifiedidentifierRepository->mutex());
diff -Nru kdevplatform-0.9.98/language/duchain/importers.cpp kdevplatform-1.0.1/language/duchain/importers.cpp
--- kdevplatform-0.9.98/language/duchain/importers.cpp 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/importers.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -78,7 +78,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.itemSize();
}
@@ -182,7 +182,7 @@
if(index) {
const ImportersItem* repositoryItem = d->m_importers.itemFromIndex(index);
- FOREACH_FUNCTION(IndexedDUContext decl, repositoryItem->importers)
+ FOREACH_FUNCTION(const IndexedDUContext& decl, repositoryItem->importers)
ret.append(decl);
}
diff -Nru kdevplatform-0.9.98/language/duchain/indexedstring.cpp kdevplatform-1.0.1/language/duchain/indexedstring.cpp
--- kdevplatform-0.9.98/language/duchain/indexedstring.cpp 2010-01-10 20:00:25.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/indexedstring.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -64,7 +64,7 @@
}
//Should return the size of an item created with createItem
- size_t itemSize() const {
+ uint itemSize() const {
return sizeof(IndexedStringData) + m_length;
}
//Should create an item where the information of the requested item is permanently stored. The pointer
@@ -271,12 +271,16 @@
}
int IndexedString::length() const {
- if(!m_index)
+ return lengthFromIndex(m_index);
+}
+
+int IndexedString::lengthFromIndex(unsigned int index) {
+ if(!index)
return 0;
- else if((m_index & 0xffff0000) == 0xffff0000)
+ else if((index & 0xffff0000) == 0xffff0000)
return 1;
else
- return getGlobalIndexedStringRepository()->itemFromIndex(m_index)->length;
+ return getGlobalIndexedStringRepository()->itemFromIndex(index)->length;
}
const char* IndexedString::c_str() const
diff -Nru kdevplatform-0.9.98/language/duchain/indexedstring.h kdevplatform-1.0.1/language/duchain/indexedstring.h
--- kdevplatform-0.9.98/language/duchain/indexedstring.h 2010-01-10 20:00:25.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/indexedstring.h 2010-07-17 19:58:27.000000000 +0100
@@ -69,6 +69,9 @@
return ret;
}
+ //This is relatively expensive(needs a mutex lock, hash lookups, and eventual loading), so avoid it when possible.
+ static int lengthFromIndex(unsigned int index);
+
IndexedString( const IndexedString& );
~IndexedString();
diff -Nru kdevplatform-0.9.98/language/duchain/instantiationinformation.h kdevplatform-1.0.1/language/duchain/instantiationinformation.h
--- kdevplatform-0.9.98/language/duchain/instantiationinformation.h 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/instantiationinformation.h 2010-07-17 19:58:27.000000000 +0100
@@ -102,7 +102,7 @@
START_APPENDED_LISTS(InstantiationInformation)
- static size_t classSize() {
+ static uint classSize() {
return sizeof(InstantiationInformation);
}
diff -Nru kdevplatform-0.9.98/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp kdevplatform-1.0.1/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp
--- kdevplatform-0.9.98/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp 2009-12-09 21:28:44.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -63,7 +63,7 @@
{
clear();
m_shorten = shorten;
- modifyHtml() += "";
+ modifyHtml() += "
" + fontSizePrefix(shorten);
addExternalHtml(m_prefix);
@@ -282,7 +282,7 @@
addExternalHtml(m_suffix);
- modifyHtml() += "
";
+ modifyHtml() += fontSizeSuffix(shorten) + "
";
return currentHtml();
}
@@ -514,7 +514,7 @@
//Also create full type-links for the context around
AbstractType::Ptr contextType = decl->context()->owner()->abstractType();
IdentifiedType* contextIdType = dynamic_cast(contextType.unsafeData());
- if(contextIdType) {
+ if(contextIdType && !contextIdType->equals(idType)) {
//Create full type information for the context
if(!id.isEmpty())
id = id.mid(id.count()-1);
diff -Nru kdevplatform-0.9.98/language/duchain/navigation/abstractincludenavigationcontext.cpp kdevplatform-1.0.1/language/duchain/navigation/abstractincludenavigationcontext.cpp
--- kdevplatform-0.9.98/language/duchain/navigation/abstractincludenavigationcontext.cpp 2010-01-10 21:02:38.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/navigation/abstractincludenavigationcontext.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -77,22 +77,19 @@
QString AbstractIncludeNavigationContext::html(bool shorten)
{
clear();
- modifyHtml() += "";
+ modifyHtml() += "
" + fontSizePrefix(shorten);
addExternalHtml(m_prefix);
KUrl u(m_item.url());
NavigationAction action(u, KTextEditor::Cursor(0,0));
- makeLink(u.fileName(), u.pathOrUrl(), action);
- QList duchains = DUChain::self()->chainsForDocument(u);
+ makeLink(u.pathOrUrl(), u.pathOrUrl(), action);
modifyHtml() += "
";
- modifyHtml() += "path: " + u.pathOrUrl();
-
+
+ QList duchains = DUChain::self()->chainsForDocument(u);
//Pick the one duchain for this document that has the most child-contexts/declarations.
//This prevents picking a context that is empty due to header-guards.
TopDUContext* duchain = pickContextWithData(duchains, 2, m_type);
- modifyHtml() += "
";
-
if(duchain) {
getFileInfo(duchain);
if(!shorten) {
@@ -106,13 +103,13 @@
addExternalHtml(m_suffix);
- modifyHtml() += "
";
+ modifyHtml() += fontSizeSuffix(shorten) + "";
return currentHtml();
}
void AbstractIncludeNavigationContext::getFileInfo(TopDUContext* duchain)
{
- modifyHtml() += QString("%1: %2 %3: %4").arg(labelHighlight(i18nc("Files included into this file", "Includes"))).arg(duchain->importedParentContexts().count()).arg(i18nc("Count of files this file was included into", "Included by")).arg(duchain->importers().count());
+ modifyHtml() += QString("%1: %2 %3: %4").arg(labelHighlight(i18nc("Files included into this file", "Includes"))).arg(duchain->importedParentContexts().count()).arg(labelHighlight(i18nc("Count of files this file was included into", "Included by"))).arg(duchain->importers().count());
modifyHtml() += "
";
}
@@ -121,7 +118,7 @@
return m_item.name;
}
-bool AbstractIncludeNavigationContext::filterDeclaration(Declaration* decl)
+bool AbstractIncludeNavigationContext::filterDeclaration(Declaration* /*decl*/)
{
return true;
}
diff -Nru kdevplatform-0.9.98/language/duchain/navigation/abstractnavigationcontext.cpp kdevplatform-1.0.1/language/duchain/navigation/abstractnavigationcontext.cpp
--- kdevplatform-0.9.98/language/duchain/navigation/abstractnavigationcontext.cpp 2009-12-09 21:28:44.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/navigation/abstractnavigationcontext.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -425,7 +425,7 @@
void AbstractNavigationContext::addHtml(QString html) {
QRegExp newLineRegExp("
|
");
- foreach(QString line, splitAndKeep(html, newLineRegExp)) {
+ foreach(const QString& line, splitAndKeep(html, newLineRegExp)) {
m_currentText += line;
if(line.indexOf(newLineRegExp) != -1) {
++m_currentLine;
@@ -440,10 +440,25 @@
return m_currentText;
}
+QString AbstractNavigationContext::fontSizePrefix(bool shorten) const
+{
+ if(shorten)
+ return "";
+ else
+ return "";
+}
+
+QString AbstractNavigationContext::fontSizeSuffix(bool shorten) const
+{
+ if(shorten)
+ return "";
+ else
+ return "";
+}
const Colorizer AbstractNavigationContext::typeHighlight("006000");
const Colorizer AbstractNavigationContext::errorHighlight("990000");
-const Colorizer AbstractNavigationContext::labelHighlight("000035");
+const Colorizer AbstractNavigationContext::labelHighlight("000000");
const Colorizer AbstractNavigationContext::codeHighlight("005000");
const Colorizer AbstractNavigationContext::propertyHighlight("009900");
const Colorizer AbstractNavigationContext::navigationHighlight("000099");
diff -Nru kdevplatform-0.9.98/language/duchain/navigation/abstractnavigationcontext.h kdevplatform-1.0.1/language/duchain/navigation/abstractnavigationcontext.h
--- kdevplatform-0.9.98/language/duchain/navigation/abstractnavigationcontext.h 2009-10-01 14:08:57.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/navigation/abstractnavigationcontext.h 2010-07-17 19:58:27.000000000 +0100
@@ -102,6 +102,11 @@
protected:
+ /// Returns the html font-size prefix (aka. or similar) for the given mode
+ QString fontSizePrefix(bool shorten) const;
+ /// Returns the html font-size suffix (aka. or similar) for the given mode
+ QString fontSizeSuffix(bool shorten) const;
+
virtual void setPreviousContext(AbstractNavigationContext* previous);
struct TextHandler {
diff -Nru kdevplatform-0.9.98/language/duchain/navigation/abstractnavigationwidget.cpp kdevplatform-1.0.1/language/duchain/navigation/abstractnavigationwidget.cpp
--- kdevplatform-0.9.98/language/duchain/navigation/abstractnavigationwidget.cpp 2009-09-16 01:16:34.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/navigation/abstractnavigationwidget.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -93,6 +93,9 @@
setLayout(layout);
connect( m_browser, SIGNAL(anchorClicked(const QUrl&)), this, SLOT(anchorClicked(const QUrl&)) );
+
+ foreach(QWidget* w, findChildren())
+ w->setContextMenuPolicy(Qt::NoContextMenu);
}
AbstractNavigationWidget::~AbstractNavigationWidget() {
diff -Nru kdevplatform-0.9.98/language/duchain/navigation/usesnavigationcontext.cpp kdevplatform-1.0.1/language/duchain/navigation/usesnavigationcontext.cpp
--- kdevplatform-0.9.98/language/duchain/navigation/usesnavigationcontext.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/navigation/usesnavigationcontext.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -36,12 +36,12 @@
return "Uses";
}
-QString UsesNavigationContext::html(bool) {
+QString UsesNavigationContext::html(bool shorten) {
clear();
- modifyHtml() += "";
+ modifyHtml() += "
" + fontSizePrefix(shorten);
if( m_previousContext ) {
- modifyHtml() += navigationHighlight("Uses of ");
+ modifyHtml() += navigationHighlight(i18n("Uses of "));
makeLink( m_previousContext->name(), m_previousContext->name(), NavigationAction(m_previousContext) );
}else{
KDevelop::DUChainReadLocker lock(DUChain::lock());
@@ -50,7 +50,7 @@
}
}
- modifyHtml() += "
";
+ modifyHtml() += fontSizeSuffix(shorten) + "";
return currentHtml();
}
diff -Nru kdevplatform-0.9.98/language/duchain/persistentsetmap.h kdevplatform-1.0.1/language/duchain/persistentsetmap.h
--- kdevplatform-0.9.98/language/duchain/persistentsetmap.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/persistentsetmap.h 2010-07-17 19:58:27.000000000 +0100
@@ -103,7 +103,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.itemSize();
}
diff -Nru kdevplatform-0.9.98/language/duchain/persistentsymboltable.cpp kdevplatform-1.0.1/language/duchain/persistentsymboltable.cpp
--- kdevplatform-0.9.98/language/duchain/persistentsymboltable.cpp 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/persistentsymboltable.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -89,7 +89,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.itemSize();
}
@@ -112,80 +112,6 @@
const PersistentSymbolTableItem& m_item;
};
-DEFINE_LIST_MEMBER_HASH(PersistentContextTableItem, contexts, IndexedDUContext)
-
-class PersistentContextTableItem {
- public:
- PersistentContextTableItem() : centralFreeItem(-1) {
- initializeAppendedLists();
- }
- PersistentContextTableItem(const PersistentContextTableItem& rhs, bool dynamic = true) : id(rhs.id), centralFreeItem(rhs.centralFreeItem) {
- initializeAppendedLists(dynamic);
- copyListsFrom(rhs);
- }
-
- ~PersistentContextTableItem() {
- freeAppendedLists();
- }
-
- inline unsigned int hash() const {
- //We only compare the context. This allows us implementing a map, although the item-repository
- //originally represents a set.
- return id.getIndex();
- }
-
- size_t itemSize() const {
- return dynamicSize();
- }
-
- uint classSize() const {
- return sizeof(PersistentContextTableItem);
- }
-
- IndexedQualifiedIdentifier id;
- int centralFreeItem;
-
- START_APPENDED_LISTS(PersistentContextTableItem);
- APPENDED_LIST_FIRST(PersistentContextTableItem, IndexedDUContext, contexts);
- END_APPENDED_LISTS(PersistentContextTableItem, contexts);
-};
-
-class PersistentContextTableRequestItem {
- public:
-
- PersistentContextTableRequestItem(const PersistentContextTableItem& item) : m_item(item) {
- }
- enum {
- AverageSize = 30 //This should be the approximate average size of an Item
- };
-
- unsigned int hash() const {
- return m_item.hash();
- }
-
- size_t itemSize() const {
- return m_item.itemSize();
- }
-
- void createItem(PersistentContextTableItem* item) const {
- new (item) PersistentContextTableItem(m_item, false);
- }
-
- static void destroy(PersistentContextTableItem* item, KDevelop::AbstractItemRepository&) {
- item->~PersistentContextTableItem();
- }
-
- static bool persistent(const PersistentContextTableItem*) {
- return true; //Nothing to do
- }
-
- bool equals(const PersistentContextTableItem* item) const {
- return m_item.id == item->id;
- }
-
- const PersistentContextTableItem& m_item;
-};
-
template
struct CacheEntry {
@@ -199,16 +125,13 @@
{
public:
- PersistentSymbolTablePrivate() : m_declarations("Persistent Declaration Table"), m_contexts("Persistent Context Table") {
- m_contexts.setMutex(m_declarations.mutex());
+ PersistentSymbolTablePrivate() : m_declarations("Persistent Declaration Table") {
}
//Maps declaration-ids to declarations
ItemRepository m_declarations;
- ItemRepository m_contexts;
QHash > m_declarationsCache;
- QHash > m_contextsCache;
//We cache the imports so the currently used nodes are very close in memory, which leads to much better CPU cache utilization
QHash m_importsCache;
@@ -219,9 +142,7 @@
ENSURE_CHAIN_WRITE_LOCKED
{
QMutexLocker lock(d->m_declarations.mutex());
- QMutexLocker lock2(d->m_contexts.mutex());
d->m_importsCache.clear();
- d->m_contextsCache.clear();
d->m_declarationsCache.clear();
}
}
@@ -384,60 +305,6 @@
}
}
-struct DUContextCacheVisitor {
- DUContextCacheVisitor(KDevVarLengthArray& _cache) : cache(_cache) {
- }
-
- bool operator()(const IndexedDUContext& decl) const {
- cache.append(decl);
- return true;
- }
-
- KDevVarLengthArray& cache;
-};
-
-PersistentSymbolTable::FilteredDUContextIterator PersistentSymbolTable::getFilteredContexts(const IndexedQualifiedIdentifier& id, const TopDUContext::IndexedRecursiveImports& visibility) const {
- QMutexLocker lock(d->m_contexts.mutex());
- ENSURE_CHAIN_READ_LOCKED
-
- Contexts contexts = getContexts(id);
-
- CachedIndexedRecursiveImports cachedImports;
-
- QHash::const_iterator it = d->m_importsCache.constFind(visibility);
- if(it != d->m_importsCache.constEnd()) {
- cachedImports = *it;
- }else{
- cachedImports = CachedIndexedRecursiveImports(visibility.set().stdSet());
- d->m_importsCache.insert(visibility, cachedImports);
- }
-
- if(contexts.dataSize() > MinimumCountForCache)
- {
- //Do visibility caching
- CacheEntry& cached(d->m_contextsCache[id]);
- CacheEntry::DataHash::const_iterator cacheIt = cached.m_hash.constFind(visibility);
- if(cacheIt != cached.m_hash.constEnd())
- return FilteredDUContextIterator(Contexts::Iterator(cacheIt->constData(), cacheIt->size(), -1), cachedImports);
-
- CacheEntry::DataHash::iterator insertIt = cached.m_hash.insert(visibility, KDevVarLengthArray());
-
- KDevVarLengthArray& cache(*insertIt);
-
- {
- typedef ConvenientEmbeddedSetTreeFilterVisitor FilteredDUContextCacheVisitor;
-
- //The visitor visits all the declarations from within its constructor
- DUContextCacheVisitor v(cache);
- FilteredDUContextCacheVisitor visitor(v, contexts.iterator(), cachedImports);
- }
-
- return FilteredDUContextIterator(Contexts::Iterator(cache.constData(), cache.size(), -1), cachedImports, true);
- }else{
- return FilteredDUContextIterator(contexts.iterator(), cachedImports);
- }
-}
-
PersistentSymbolTable::Declarations PersistentSymbolTable::getDeclarations(const IndexedQualifiedIdentifier& id) const {
QMutexLocker lock(d->m_declarations.mutex());
ENSURE_CHAIN_READ_LOCKED
@@ -477,139 +344,6 @@
}
}
-void PersistentSymbolTable::addContext(const IndexedQualifiedIdentifier& id, const IndexedDUContext& context)
-{
- QMutexLocker lock(d->m_contexts.mutex());
- ENSURE_CHAIN_WRITE_LOCKED
-
- d->m_contextsCache.remove(id);
-
- PersistentContextTableItem item;
- item.id = id;
- PersistentContextTableRequestItem request(item);
-
- uint index = d->m_contexts.findIndex(item);
-
- if(index) {
- //Check whether the item is already in the mapped list, else copy the list into the new created item
- const PersistentContextTableItem* oldItem = d->m_contexts.itemFromIndex(index);
-
- EmbeddedTreeAlgorithms alg(oldItem->contexts(), oldItem->contextsSize(), oldItem->centralFreeItem);
-
- if(alg.indexOf(context) != -1)
- return;
-
- QMutexLocker lock(d->m_contexts.mutex());
-
- DynamicItem editableItem = d->m_contexts.dynamicItemFromIndex(index);
-
- EmbeddedTreeAddItem add(const_cast(editableItem->contexts()), editableItem->contextsSize(), editableItem->centralFreeItem, context);
-
- uint newSize = add.newItemCount();
- if(newSize != editableItem->contextsSize()) {
- //We need to resize. Update and fill the new item, and delete the old item.
- item.contextsList().resize(newSize);
- add.transferData(item.contextsList().data(), newSize, &item.centralFreeItem);
-
- d->m_contexts.deleteItem(index);
- Q_ASSERT(!d->m_contexts.findIndex(request));
- }else{
- //We're fine, the item could be added to the existing list
- return;
- }
- }else{
- item.contextsList().append(context);
- }
-
- //This inserts the changed item
- d->m_contexts.index(request);
-}
-
-void PersistentSymbolTable::removeContext(const IndexedQualifiedIdentifier& id, const IndexedDUContext& context)
-{
- QMutexLocker lock(d->m_contexts.mutex());
- ENSURE_CHAIN_WRITE_LOCKED
-
- d->m_contextsCache.remove(id);
-
- PersistentContextTableItem item;
- item.id = id;
- PersistentContextTableRequestItem request(item);
-
- uint index = d->m_contexts.findIndex(item);
-
- if(index) {
- //Check whether the item is already in the mapped list, else copy the list into the new created item
- const PersistentContextTableItem* oldItem = d->m_contexts.itemFromIndex(index);
-
- EmbeddedTreeAlgorithms alg(oldItem->contexts(), oldItem->contextsSize(), oldItem->centralFreeItem);
-
- if(alg.indexOf(context) == -1)
- return;
-
- QMutexLocker lock(d->m_contexts.mutex());
-
- DynamicItem editableItem = d->m_contexts.dynamicItemFromIndex(index);
-
- EmbeddedTreeRemoveItem remove(const_cast(editableItem->contexts()), editableItem->contextsSize(), editableItem->centralFreeItem, context);
-
- uint newSize = remove.newItemCount();
- if(newSize != editableItem->contextsSize()) {
- //We need to resize. Update and fill the new item, and delete the old item.
- item.contextsList().resize(newSize);
- remove.transferData(item.contextsList().data(), newSize, &item.centralFreeItem);
-
- d->m_contexts.deleteItem(index);
- Q_ASSERT(!d->m_contexts.findIndex(request));
- }else{
- //We're fine, the item could be added to the existing list
- return;
- }
- }
-
- //This inserts the changed item
- if(item.contextsSize())
- d->m_contexts.index(request);
-}
-
-PersistentSymbolTable::Contexts PersistentSymbolTable::getContexts(const IndexedQualifiedIdentifier& id) const {
- QMutexLocker lock(d->m_contexts.mutex());
- ENSURE_CHAIN_READ_LOCKED
-
- PersistentContextTableItem item;
- item.id = id;
- PersistentContextTableRequestItem request(item);
-
- uint index = d->m_contexts.findIndex(item);
-
- if(index) {
- const PersistentContextTableItem* repositoryItem = d->m_contexts.itemFromIndex(index);
- return PersistentSymbolTable::Contexts(repositoryItem->contexts(), repositoryItem->contextsSize(), repositoryItem->centralFreeItem);
- }else{
- return PersistentSymbolTable::Contexts();
- }
-}
-
-void PersistentSymbolTable::contexts(const IndexedQualifiedIdentifier& id, uint& countTarget, const IndexedDUContext*& contextsTarget) const {
- QMutexLocker lock(d->m_contexts.mutex());
- ENSURE_CHAIN_READ_LOCKED
-
- PersistentContextTableItem item;
- item.id = id;
- PersistentContextTableRequestItem request(item);
-
- uint index = d->m_contexts.findIndex(item);
-
- if(index) {
- const PersistentContextTableItem* repositoryItem = d->m_contexts.itemFromIndex(index);
- countTarget = repositoryItem->contextsSize();
- contextsTarget = repositoryItem->contexts();
- }else{
- countTarget = 0;
- contextsTarget = 0;
- }
-}
-
struct Visitor {
bool operator() (const PersistentSymbolTableItem* item) {
QualifiedIdentifier id(item->id.identifier());
@@ -642,27 +376,6 @@
QHash declarations;
};
-struct ContextVisitor {
- bool operator() (const PersistentContextTableItem* item) {
- QualifiedIdentifier id(item->id.identifier());
- if(identifiers.contains(id)) {
- kDebug() << "identifier" << id.toString() << "appears for" << identifiers[id] << "th time";
- }
-
- ++identifiers[id];
-
- for(uint a = 0; a < item->contextsSize(); ++a) {
- if(!item->contexts()[a].data() && !!item->contexts()[a].isDummy()) {
- kDebug() << "Item in Context-table is invalid:" << id.toString() << item->contexts()[a].localIndex() << IndexedTopDUContext(item->contexts()[a].topContextIndex()).url().str();
- }else if(item->contexts()[a].data() && item->contexts()[a].data()->scopeIdentifier(true) != id) {
- kDebug() << item->contexts()[a].data()->url().str() << "context" << item->contexts()[a].data()->scopeIdentifier(true) << "is registered as" << id;
- }
- }
- return true;
- }
- QHash identifiers;
-};
-
void PersistentSymbolTable::selfAnalysis() {
{
QMutexLocker lock(d->m_declarations.mutex());
@@ -672,15 +385,6 @@
d->m_declarations.visitAllItems(v);
kDebug() << "visited" << v.identifiers.size() << "identifiers";
}
-
- {
- QMutexLocker lock(d->m_contexts.mutex());
-
- ContextVisitor v;
- kDebug() << d->m_contexts.statistics();
- d->m_contexts.visitAllItems(v);
- kDebug() << "visited" << v.identifiers.size() << "identifiers";
- }
}
PersistentSymbolTable& PersistentSymbolTable::self() {
diff -Nru kdevplatform-0.9.98/language/duchain/persistentsymboltable.h kdevplatform-1.0.1/language/duchain/persistentsymboltable.h
--- kdevplatform-0.9.98/language/duchain/persistentsymboltable.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/persistentsymboltable.h 2010-07-17 19:58:27.000000000 +0100
@@ -161,37 +161,6 @@
///The returned iterator is valid as long as the duchain read lock is held
FilteredDeclarationIterator getFilteredDeclarations(const IndexedQualifiedIdentifier& id, const TopDUContext::IndexedRecursiveImports& visibility) const;
- ///Adds context @p context with id @p id to the symbol table
- ///@warning DUChain must be write locked
- void addContext(const IndexedQualifiedIdentifier& id, const IndexedDUContext& context);
-
- ///Removes context @p context with id @p id to the symbol table
- ///@warning DUChain must be write locked
- void removeContext(const IndexedQualifiedIdentifier& id, const IndexedDUContext& context);
-
- ///Retrieves all the contexts for a given IndexedQualifiedIdentifier in an efficient way.
- ///@param id The IndexedQualifiedIdentifier for which the contexts should be retrieved
- ///@param count A reference that will be filled with the count of retrieved contexts
- ///@param contexts A reference to a pointer, that will be filled with a pointer to the retrieved contexts.
- ///@warning DUChain must be read locked as long as the returned data is used
- void contexts(const IndexedQualifiedIdentifier& id, uint& count, const IndexedDUContext*& contexts) const;
-
- typedef ConstantConvenientEmbeddedSet Contexts;
-
- ///Retrieves all the contexts for a given IndexedQualifiedIdentifier in an efficient way, and returns them
- ///in a more user-friendly structure then contexs().
- ///@param id The IndexedQualifiedIdentifier for which the contexts should be retrieved
- ///@warning DUChain must be read locked as long as the returned data is used
- Contexts getContexts(const IndexedQualifiedIdentifier& id) const;
-
- typedef ConvenientEmbeddedSetTreeFilterIterator FilteredDUContextIterator;
-
- ///Retrieves an iterator to all declarations of the given id, filtered by the visilibity given through @param visibility
- ///This is very efficient since it uses a cache
- ///The returned iterator is valid as long as the duchain read lock is held
- ///@warning DUChain must be read locked as long as the returned data is used
- FilteredDUContextIterator getFilteredContexts(const IndexedQualifiedIdentifier& id, const TopDUContext::IndexedRecursiveImports& visibility) const;
-
static PersistentSymbolTable& self();
//Very expensive: Checks for problems in the symbol table
diff -Nru kdevplatform-0.9.98/language/duchain/repositories/itemrepository.cpp kdevplatform-1.0.1/language/duchain/repositories/itemrepository.cpp
--- kdevplatform-0.9.98/language/duchain/repositories/itemrepository.cpp 2009-12-17 16:08:27.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/repositories/itemrepository.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -37,7 +37,7 @@
uint staticItemRepositoryVersion() {
//Increase this to reset incompatible item-repositories
- return 65;
+ return 67;
}
AbstractItemRepository::~AbstractItemRepository() {
diff -Nru kdevplatform-0.9.98/language/duchain/repositories/itemrepository.h kdevplatform-1.0.1/language/duchain/repositories/itemrepository.h
--- kdevplatform-0.9.98/language/duchain/repositories/itemrepository.h 2009-12-15 13:49:19.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/repositories/itemrepository.h 2010-07-17 19:58:27.000000000 +0100
@@ -283,7 +283,7 @@
}
///Should return the size of an item created with createItem
- size_t itemSize() const {
+ uint itemSize() const {
return 0;
}
///Should create an item where the information of the requested item is permanently stored. The pointer
diff -Nru kdevplatform-0.9.98/language/duchain/repositories/stringrepository.h kdevplatform-1.0.1/language/duchain/repositories/stringrepository.h
--- kdevplatform-0.9.98/language/duchain/repositories/stringrepository.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/repositories/stringrepository.h 2010-07-17 19:58:27.000000000 +0100
@@ -63,7 +63,7 @@
}
//Should return the size of an item created with createItem
- size_t itemSize() const {
+ uint itemSize() const {
return sizeof(StringData) + m_length;
}
//Should create an item where the information of the requested item is permanently stored. The pointer
diff -Nru kdevplatform-0.9.98/language/duchain/repositories/typerepository.cpp kdevplatform-1.0.1/language/duchain/repositories/typerepository.cpp
--- kdevplatform-0.9.98/language/duchain/repositories/typerepository.cpp 2009-10-26 16:44:36.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/repositories/typerepository.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -42,7 +42,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return TypeSystem::self().dynamicSize(*m_item.d_ptr);
}
diff -Nru kdevplatform-0.9.98/language/duchain/stringhelpers.cpp kdevplatform-1.0.1/language/duchain/stringhelpers.cpp
--- kdevplatform-0.9.98/language/duchain/stringhelpers.cpp 2009-10-26 19:12:22.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/stringhelpers.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -146,7 +146,7 @@
QString ret;
int len = str.length();
for( int a = len-1; a >= 0; --a ) {
- switch(str[a].toAscii()) {
+ switch(str[a].unicode()) {
case '(':
ret += ')';
continue;
@@ -290,6 +290,11 @@
lastPos = i+2;
if( lastPos == len ) break;
} else {
+ if ( i == -1 ) {
+ // unterminated comment, might happen during code completion
+ // see also: https://bugs.kde.org/show_bug.cgi?id=231351
+ fillString( str, pos, len, replacement );
+ }
break;
}
}
@@ -313,7 +318,26 @@
QString clearStrings( QString str, QChar replacement ) {
bool inString = false;
for(int pos = 0; pos < str.length(); ++pos) {
-
+ //Skip cpp comments
+ if(!inString && pos + 1 < str.length() && str[pos] == '/' && str[pos+1] == '*')
+ {
+ pos += 2;
+ while(pos + 1 < str.length()) {
+ if (str[pos] == '*' && str[pos + 1] == '/') {
+ ++pos;
+ break;
+ }
+ ++pos;
+ }
+ }
+ //Skip cstyle comments
+ if(!inString && pos + 1 < str.length() && str[pos] == '/' && str[pos+1] == '/')
+ {
+ pos += 2;
+ while(pos < str.length() && str[pos] != '\n') {
+ ++pos;
+ }
+ }
//Skip a character a la 'b'
if(!inString && str[pos] == '\'' && pos + 3 <= str.length())
{
diff -Nru kdevplatform-0.9.98/language/duchain/topducontext.cpp kdevplatform-1.0.1/language/duchain/topducontext.cpp
--- kdevplatform-0.9.98/language/duchain/topducontext.cpp 2009-12-13 15:29:13.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/topducontext.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -40,7 +40,6 @@
#include "aliasdeclaration.h"
#include "abstractfunctiondeclaration.h"
#include "uses.h"
-#include "arrayhelpers.h"
#include "topducontextdata.h"
#include "duchainregister.h"
#include "topducontextdynamicdata.h"
@@ -143,17 +142,6 @@
QMutex importStructureMutex(QMutex::Recursive);
-template
-bool removeOneImport(Container& container, const DUContext* value) {
- for(int a = 0; a < container.size(); ++a) {
- if(container[a].context() == value) {
- removeFromArray(container, a);
- return true;
- }
- }
- return false;
-}
-
//Contains data that is not shared among top-contexts that share their duchain entries
class TopDUContextLocalPrivate {
public:
@@ -221,7 +209,7 @@
addImportedContextRecursively(top, false, true);
}
}
- FOREACH_FUNCTION(IndexedDUContext importer, m_ctxt->d_func()->m_importers) {
+ FOREACH_FUNCTION(const IndexedDUContext& importer, m_ctxt->d_func()->m_importers) {
if(DUChain::self()->isInMemory(importer.topContextIndex())) {
Q_ASSERT(importer.context());
TopDUContext* top = importer.context()->topContext();
@@ -522,33 +510,6 @@
}
};
-TopDUContext::ContextChecker::ContextChecker(const TopDUContext* _top, const SimpleCursor& _position, ContextType _contextType, DUContext::SearchFlags _flags) : top(_top), position(_position), contextType(_contextType), flags(_flags)
-{
-}
-
-bool TopDUContext::ContextChecker::operator()(const DUContext* ctx) const {
-
- if(!ctx)
- return false;
-
- if (top != ctx->topContext()) {
-
- // Make sure that this declaration is accessible
-
- if (ctx->type() != contextType)
- return false;
- } else {
- if (ctx->type() != contextType)
- return false;
-
- if (ctx->range().start > position)
- if(!ctx->parentContext() || ctx->parentContext()->type() != Class)
- return false;
- }
- //Success
- return true;
-}
-
///Takes a set of conditions in the constructors, and checks with each call to operator() whether these conditions are fulfilled on the given declaration.
///The import-structure needs to be constructed and locked when this is used
TopDUContext::DeclarationChecker::DeclarationChecker(const TopDUContext* _top, const SimpleCursor& _position, const AbstractType::Ptr& _dataType, DUContext::SearchFlags _flags, KDevVarLengthArray* _createVisibleCache)
@@ -974,7 +935,7 @@
ENSURE_CAN_READ
#ifdef DEBUG_SEARCH
- FOREACH_ARRAY(SearchItem::Ptr idTree, identifiers)
+ FOREACH_ARRAY(const SearchItem::Ptr& idTree, identifiers)
foreach(const QualifiedIdentifier &id, idTree->toList())
kDebug() << "searching item" << id.toString();
#endif
@@ -1091,7 +1052,7 @@
return false;
}else{
//Create an identifiers where namespace-alias part is replaced with the alias target
- FOREACH_ARRAY(SearchItem::Ptr item, identifier->next)
+ FOREACH_ARRAY(const SearchItem::Ptr& item, identifier->next)
if(!applyAliases(importIdentifier, item, accept, position, canBeNamespace, &info, recursionDepth+1))
return false;
}
@@ -1105,7 +1066,7 @@
if(!accept(id)) //We're at the end of a qualified identifier, accept it
return false;
} else {
- FOREACH_ARRAY(SearchItem::Ptr next, identifier->next)
+ FOREACH_ARRAY(const SearchItem::Ptr& next, identifier->next)
if(!applyAliases(id, next, accept, position, canBeNamespace, 0, recursionDepth+1))
return false;
}
@@ -1121,7 +1082,7 @@
importId.push(globalImportIdentifier);
#ifdef DEBUG_SEARCH
- kDebug() << "checking imports in" << (backPointer ? id.toString() : QString("global"));
+// kDebug() << "checking imports in" << (backPointer ? id.toString() : QString("global"));
#endif
if(importId.inRepository()) {
@@ -1176,76 +1137,10 @@
{
QualifiedIdentifier emptyId;
- FOREACH_ARRAY(SearchItem::Ptr item, identifiers)
+ FOREACH_ARRAY(const SearchItem::Ptr& item, identifiers)
applyAliases(emptyId, item, acceptor, position, canBeNamespace, 0, 0);
}
-struct TopDUContext::FindContextsAcceptor {
- FindContextsAcceptor(const TopDUContext* _top, QList& _target, const ContextChecker& _check, SearchFlags _flags) : top(_top), target(_target), check(_check), flags(_flags) {
- cache = _top->m_local->currentCache();
- }
-
- bool operator() (const QualifiedIdentifier& id) {
-
- PersistentSymbolTable::Contexts allDecls;
-
-#ifdef DEBUG_SEARCH
- kDebug() << "accepting" << id.toString();
-#endif
- kDebug() << "accepting" << id.toString() << id.inRepository();
-
- //This iterator efficiently filters the visible declarations out of all declarations
- PersistentSymbolTable::FilteredDUContextIterator filter;
-
- //This is used if filterung is disabled
- PersistentSymbolTable::Contexts::Iterator unchecked;
- if(check.flags & DUContext::NoImportsCheck) {
- allDecls = PersistentSymbolTable::self().getContexts(id);
- unchecked = allDecls.iterator();
- } else
- filter = PersistentSymbolTable::self().getFilteredContexts(id, top->recursiveImportIndices());
-
- while(filter || unchecked) {
-
- IndexedDUContext iDecl;
- if(filter) {
- iDecl = *filter;
- ++filter;
- } else {
- iDecl = *unchecked;
- ++unchecked;
- }
-
- DUContext* ctx = iDecl.data();
- if(!ctx)
- continue;
-
- if(!check(ctx))
- continue;
-
- target << ctx;
- }
- return true;
- }
-
- const TopDUContext* top;
- CacheData* cache;
- QList& target;
- const ContextChecker& check;
- SearchFlags flags;
-};
-
-void TopDUContext::findContextsInternal(ContextType contextType, const SearchItem::PtrList& baseIdentifiers, const SimpleCursor& position, QList& ret, const TopDUContext* source, SearchFlags flags) const {
- Q_UNUSED(source);
- ENSURE_CAN_READ
- ContextChecker check(this, position, contextType, flags & DUContext::NoImportsCheck);
- FindContextsAcceptor storer(this, ret, check, flags);
-
- ///The actual scopes are found within applyAliases, and each complete qualified identifier is given to FindContextsAcceptor.
- ///That stores the found declaration to the output.
- applyAliases(baseIdentifiers, storer, position, contextType == Namespace);
-}
-
TopDUContext* TopDUContext::sharedDataOwner() const
{
return m_local->m_sharedDataOwner;
diff -Nru kdevplatform-0.9.98/language/duchain/topducontextdynamicdata.cpp kdevplatform-1.0.1/language/duchain/topducontextdynamicdata.cpp
--- kdevplatform-0.9.98/language/duchain/topducontextdynamicdata.cpp 2009-12-19 17:51:35.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/topducontextdynamicdata.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -183,7 +183,7 @@
//We only read the most needed stuff, not the whole top-context data
QByteArray data = file.read(readValue);
const TopDUContextData* topData = (const TopDUContextData*)data.constData();
- FOREACH_FUNCTION(IndexedDUContext importer, topData->m_importers)
+ FOREACH_FUNCTION(const IndexedDUContext& importer, topData->m_importers)
ret << importer;
}
@@ -204,7 +204,7 @@
//We only read the most needed stuff, not the whole top-context data
QByteArray data = file.read(readValue);
const TopDUContextData* topData = (const TopDUContextData*)data.constData();
- FOREACH_FUNCTION(DUContext::Import import, topData->m_importedContexts)
+ FOREACH_FUNCTION(const DUContext::Import& import, topData->m_importedContexts)
ret << import.indexedContext();
}
diff -Nru kdevplatform-0.9.98/language/duchain/topducontext.h kdevplatform-1.0.1/language/duchain/topducontext.h
--- kdevplatform-0.9.98/language/duchain/topducontext.h 2009-12-13 15:29:13.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/topducontext.h 2010-07-17 19:58:27.000000000 +0100
@@ -225,7 +225,10 @@
///Additional update-flags that have a special meaning during updating, but are not set stored into a top-context
Recursive = 64, //Request the given features on all recursively imported contexts. Only the features are applied recursively (including AST)
ForceUpdate = 128, //Enforce updating the top-context
- ForceUpdateRecursive = ForceUpdate | 256 //Enforce updating the top-context and all its imports
+ ForceUpdateRecursive = ForceUpdate | 256, //Enforce updating the top-context and all its imports
+
+ ///You can define own language-dependent features behind this flag
+ LastFeature = 512
};
///Returns the currently active features of this top-context. The features will include AST if ast() is valid.
@@ -363,8 +366,6 @@
protected:
void setParsingEnvironmentFile(ParsingEnvironmentFile*);
- virtual void findContextsInternal(ContextType contextType, const SearchItem::PtrList& identifiers, const SimpleCursor& position, QList& ret, const TopDUContext* source, SearchFlags flags = NoSearchFlags) const;
-
/**
* Does the same as DUContext::updateAliases, except that it uses the symbol-store, and processes the whole identifier.
* @param canBeNamespace whether the searched identifier may be a namespace.
diff -Nru kdevplatform-0.9.98/language/duchain/topducontextutils.h kdevplatform-1.0.1/language/duchain/topducontextutils.h
--- kdevplatform-0.9.98/language/duchain/topducontextutils.h 2009-03-07 13:31:54.000000000 +0000
+++ kdevplatform-1.0.1/language/duchain/topducontextutils.h 2010-07-17 19:58:27.000000000 +0100
@@ -38,18 +38,6 @@
DUContext::SearchFlags flags;
};
-struct KDEVPLATFORMLANGUAGE_EXPORT TopDUContext::ContextChecker
-{
- ContextChecker(const TopDUContext* _top, const SimpleCursor& _position, ContextType _contextType, DUContext::SearchFlags _flags);
-
- bool operator()(const DUContext* context) const;
-
- const TopDUContext* top;
- const SimpleCursor& position;
- ContextType contextType;
- DUContext::SearchFlags flags;
-};
-
}
#endif // TOPDUCONTEXTUTILS_H
diff -Nru kdevplatform-0.9.98/language/duchain/types/abstracttype.h kdevplatform-1.0.1/language/duchain/types/abstracttype.h
--- kdevplatform-0.9.98/language/duchain/types/abstracttype.h 2009-04-22 14:16:03.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/abstracttype.h 2010-07-17 19:58:27.000000000 +0100
@@ -222,7 +222,7 @@
template
static typename Type::Data& copyData(const typename Type::Data& rhs) {
- size_t size;
+ uint size;
if(!rhs.m_dynamic)
size = sizeof(typename Type::Data); //Create a dynamic data instance
else
@@ -238,7 +238,7 @@
*/
template
static DataType& copyDataDirectly(const DataType& rhs) {
- size_t size;
+ uint size;
if(!rhs.m_dynamic)
size = sizeof(DataType); //Create a dynamic data instance
else
diff -Nru kdevplatform-0.9.98/language/duchain/types/arraytype.cpp kdevplatform-1.0.1/language/duchain/types/arraytype.cpp
--- kdevplatform-0.9.98/language/duchain/types/arraytype.cpp 2009-04-22 13:14:10.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/arraytype.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -88,6 +88,9 @@
QString ArrayType::toString() const
{
+ if (d_func()->m_dimension == 0) {
+ return QString("%1[]").arg(elementType() ? elementType()->toString() : QString(""));
+ }
return QString("%1[%2]").arg(elementType() ? elementType()->toString() : QString("")).arg(d_func()->m_dimension);
}
diff -Nru kdevplatform-0.9.98/language/duchain/types/arraytype.h kdevplatform-1.0.1/language/duchain/types/arraytype.h
--- kdevplatform-0.9.98/language/duchain/types/arraytype.h 2009-04-05 01:28:37.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/arraytype.h 2010-07-17 19:58:27.000000000 +0100
@@ -55,6 +55,7 @@
/**
* Set this array type's dimension.
+ * If @p dimension is zero, the array is considered dimensionless (eg. int[]).
*
* \param dimension new dimension, set to zero for a dimensionless type (eg. int[])
*/
diff -Nru kdevplatform-0.9.98/language/duchain/types/functiontype.cpp kdevplatform-1.0.1/language/duchain/types/functiontype.cpp
--- kdevplatform-0.9.98/language/duchain/types/functiontype.cpp 2009-04-22 13:14:10.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/functiontype.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -117,7 +117,7 @@
{
///@todo Don't do the conversion
QList ret;
- FOREACH_FUNCTION(IndexedType arg, d_func()->m_arguments)
+ FOREACH_FUNCTION(const IndexedType& arg, d_func()->m_arguments)
ret << arg.abstractType();
return ret;
}
@@ -196,7 +196,7 @@
uint hash_value = AbstractType::hash();
hash_value += d_func()->m_returnType.hash() * 859321;
- FOREACH_FUNCTION(IndexedType t, d_func()->m_arguments) {
+ FOREACH_FUNCTION(const IndexedType& t, d_func()->m_arguments) {
hash_value = (hash_value << 5) - hash_value + t.hash();
}
diff -Nru kdevplatform-0.9.98/language/duchain/types/typeregister.cpp kdevplatform-1.0.1/language/duchain/types/typeregister.cpp
--- kdevplatform-0.9.98/language/duchain/types/typeregister.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/typeregister.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -37,7 +37,7 @@
return m_fastFactories[data.typeClassId]->dynamicSize(data);
}
-size_t TypeSystem::dataClassSize(const AbstractTypeData& data) const {
+uint TypeSystem::dataClassSize(const AbstractTypeData& data) const {
if(uint(m_dataClassSizes.size()) <= data.typeClassId || m_fastFactories[data.typeClassId] == 0)
return 0;
return m_fastDataClassSizes[data.typeClassId];
diff -Nru kdevplatform-0.9.98/language/duchain/types/typeregister.h kdevplatform-1.0.1/language/duchain/types/typeregister.h
--- kdevplatform-0.9.98/language/duchain/types/typeregister.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/typeregister.h 2010-07-17 19:58:27.000000000 +0100
@@ -169,7 +169,7 @@
///Returns the size of the derived class, not including dynamic data.
///Returns zero if the class is not known.
- size_t dataClassSize(const AbstractTypeData& data) const;
+ uint dataClassSize(const AbstractTypeData& data) const;
///Calls the destructor, but does not delete anything. This is needed because the data classes must not contain virtual members.
void callDestructor(AbstractTypeData* data) const;
@@ -181,8 +181,8 @@
QVector m_factories;
AbstractTypeFactory** m_fastFactories;
- QVector m_dataClassSizes;
- size_t* m_fastDataClassSizes;
+ QVector m_dataClassSizes;
+ uint* m_fastDataClassSizes;
};
/// Helper class to register an AbstractType subclass.
diff -Nru kdevplatform-0.9.98/language/duchain/types/unsuretype.cpp kdevplatform-1.0.1/language/duchain/types/unsuretype.cpp
--- kdevplatform-0.9.98/language/duchain/types/unsuretype.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/types/unsuretype.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -30,7 +30,7 @@
}
void UnsureType::accept0(KDevelop::TypeVisitor* v) const {
- FOREACH_FUNCTION(IndexedType type, d_func()->m_types) {
+ FOREACH_FUNCTION(const IndexedType& type, d_func()->m_types) {
AbstractType::Ptr t = type.abstractType();
v->visit(t.unsafeData());
}
@@ -43,7 +43,7 @@
QString UnsureType::toString() const {
QString ret = "unsure (";
bool first = true;
- FOREACH_FUNCTION(IndexedType type, d_func()->m_types) {
+ FOREACH_FUNCTION(const IndexedType& type, d_func()->m_types) {
if(!first)
ret += ", ";
first = false;
@@ -77,7 +77,7 @@
uint UnsureType::hash() const {
uint ret = AbstractType::hash();
- FOREACH_FUNCTION(IndexedType type, d_func()->m_types)
+ FOREACH_FUNCTION(const IndexedType& type, d_func()->m_types)
ret = 17 * ret + type.hash();
return ret;
diff -Nru kdevplatform-0.9.98/language/duchain/uses.cpp kdevplatform-1.0.1/language/duchain/uses.cpp
--- kdevplatform-0.9.98/language/duchain/uses.cpp 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/language/duchain/uses.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -78,7 +78,7 @@
return m_item.hash();
}
- size_t itemSize() const {
+ uint itemSize() const {
return m_item.itemSize();
}
@@ -182,7 +182,7 @@
if(index) {
const UsesItem* repositoryItem = d->m_uses.itemFromIndex(index);
- FOREACH_FUNCTION(IndexedTopDUContext decl, repositoryItem->uses)
+ FOREACH_FUNCTION(const IndexedTopDUContext& decl, repositoryItem->uses)
ret.append(decl);
}
diff -Nru kdevplatform-0.9.98/language/editor/documentrangeobject.cpp kdevplatform-1.0.1/language/editor/documentrangeobject.cpp
--- kdevplatform-0.9.98/language/editor/documentrangeobject.cpp 2010-01-16 13:25:21.000000000 +0000
+++ kdevplatform-1.0.1/language/editor/documentrangeobject.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -59,10 +59,12 @@
void DocumentRangeObject::aboutToWriteData() {
}
+const int smartLockTimeout = 10;
+
struct OptionalMutexLocker {
OptionalMutexLocker(QMutex& mutex, uint timeout) : m_mutex(mutex), m_locked(false)
{
- m_locked = m_mutex.tryLock(1000);
+ m_locked = m_mutex.tryLock(timeout);
}
~OptionalMutexLocker() {
@@ -78,7 +80,7 @@
if(!dd_ptr)
return d_ptr->m_range;
- OptionalMutexLocker l(*dd_ptr->m_smartMutex, 1000);
+ OptionalMutexLocker l(*dd_ptr->m_smartMutex, smartLockTimeout);
if(!dd_ptr->m_smartRange)
return d_ptr->m_range;
@@ -100,7 +102,7 @@
void DocumentRangeObject::syncToSmart() const {
if(!dd_ptr)
return;
- OptionalMutexLocker l(*dd_ptr->m_smartMutex, 1000);
+ OptionalMutexLocker l(*dd_ptr->m_smartMutex, smartLockTimeout);
if(!dd_ptr->m_smartRange)
return;
diff -Nru kdevplatform-0.9.98/language/editor/modificationrevision.cpp kdevplatform-1.0.1/language/editor/modificationrevision.cpp
--- kdevplatform-0.9.98/language/editor/modificationrevision.cpp 2009-11-22 23:54:29.000000000 +0000
+++ kdevplatform-1.0.1/language/editor/modificationrevision.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -26,19 +26,22 @@
#if defined(Q_CC_MSVC)
#include
-#else
-// DEPRECATED (should use unordered_map), but needed to support gcc 3.4 and early 4.x
+using namespace stdext;
+#elif defined GXX_LT_4_3
#include
+using namespace __gnu_cxx;
+#else // C++0X
+// TODO: Replace hash_map with unordered map when support for G++ < 4.3 has
+// ended. This class was added as a temporary workaround, to get rid of
+// hash_map related warnings for g++ >= 4.3.
+#include
+template,
+ class _Pred = std::equal_to<_Key>,
+ class _Alloc = std::allocator > >
+class hash_map : public std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> { };
#endif
-namespace std {
-#if defined(Q_CC_MSVC)
- using namespace stdext;
-#else
- using namespace __gnu_cxx;
-#endif
-}
-
#include "editorintegrator.h"
#include "hashedstring.h"
@@ -72,11 +75,8 @@
timeval m_readTime;
QDateTime m_modificationTime;
};
-#ifdef Q_CC_MSVC
- typedef stdext::hash_map FileModificationMap;
-#else
- typedef __gnu_cxx::hash_map FileModificationMap;
-#endif
+
+typedef hash_map FileModificationMap;
FileModificationMap& fileModificationCache() {
static FileModificationMap cache;
diff -Nru kdevplatform-0.9.98/language/editor/modificationrevisionset.h kdevplatform-1.0.1/language/editor/modificationrevisionset.h
--- kdevplatform-0.9.98/language/editor/modificationrevisionset.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/editor/modificationrevisionset.h 2010-07-17 19:58:27.000000000 +0100
@@ -55,7 +55,7 @@
}
bool operator==(const ModificationRevisionSet& rhs) const {
- return m_index != rhs.m_index;
+ return m_index == rhs.m_index;
}
ModificationRevisionSet& operator+=(const ModificationRevisionSet& rhs);
diff -Nru kdevplatform-0.9.98/language/highlighting/codehighlighting.cpp kdevplatform-1.0.1/language/highlighting/codehighlighting.cpp
--- kdevplatform-0.9.98/language/highlighting/codehighlighting.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/highlighting/codehighlighting.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -53,9 +53,6 @@
CodeHighlighting::CodeHighlighting( QObject * parent )
: QObject(parent), m_localColorization(true), m_globalColorization(true)
{
- // make sure the singleton is setup
- ColorCache::initialize();
-
adaptToColorChanges();
connect(ColorCache::self(), SIGNAL(colorsGotChanged()),
@@ -159,7 +156,7 @@
void CodeHighlighting::highlightDUChain(TopDUContext* context) const
{
- kDebug() << "highlighting du chain";
+ kDebug() << "highlighting du chain" << context->url().toUrl();
DUChainReadLocker lock(DUChain::lock());
@@ -218,6 +215,7 @@
return;
}
+ ///TODO: 4.1 make this overloadable, e.g. in PHP we also want local colorization in global context
bool isInFunction = context->type() == DUContext::Function || (context->type() == DUContext::Other && context->owner());
if( isInFunction && m_highlighting->m_localColorization ) {
@@ -387,7 +385,7 @@
if(dec->kind() == Declaration::Namespace)
return NamespaceType;
- if (context && dec->context()->type() == DUContext::Class) {
+ if (context && dec->context() && dec->context()->type() == DUContext::Class) {
//It is a use.
//Determine the class we're in
Declaration* klass = localClassFromCodeContext(context);
@@ -473,25 +471,7 @@
void CodeHighlightingInstance::highlightUses(DUContext* context) const
{
for(int a = 0; a < context->usesCount(); ++a) {
- if (SmartRange* range = context->useSmartRange(a)) {
- Types type = ErrorVariableType;
- Declaration* decl = context->topContext()->usedDeclarationForIndex(context->uses()[a].m_declarationIndex);
- if (decl)
- type = typeForDeclaration(decl, context);
-
- LOCK_SMART(range);
-
- if(!m_highlighting->isCodeHighlight(range->attribute()))
- continue;
-
- if(type != ErrorVariableType || ICore::self()->languageController()->completionSettings()->highlightSemanticProblems())
- range->setAttribute(m_highlighting->attributeForType(type, ReferenceContext, QColor(QColor::Invalid)));
- else
- range->setAttribute(KTextEditor::Attribute::Ptr());
-
-// kDebug() << range->attribute()->underlineStyle() << range->attribute()->background().iscolor().isValid();
- Q_ASSERT(m_highlighting->isCodeHighlight(range->attribute()));
- }
+ highlightUse(context, a, QColor(QColor::Invalid));
}
}
diff -Nru kdevplatform-0.9.98/language/highlighting/codehighlighting.h kdevplatform-1.0.1/language/highlighting/codehighlighting.h
--- kdevplatform-0.9.98/language/highlighting/codehighlighting.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/highlighting/codehighlighting.h 2010-07-17 19:58:27.000000000 +0100
@@ -95,6 +95,7 @@
virtual void highlightDeclaration(KDevelop::Declaration* declaration, const QColor &color) const;
virtual void highlightUse(KDevelop::DUContext* context, int index, const QColor &color) const;
+ ///TODO: evaluate whether this should stay virtual for 4.1 and later
virtual void highlightUses(KDevelop::DUContext* context) const;
void highlightDUChainSimple(KDevelop::DUContext* context) const;
@@ -105,6 +106,7 @@
KDevelop::Declaration* localClassFromCodeContext(KDevelop::DUContext* context) const;
/**
* @param context Should be the context from where the declaration is used, if a use is highlighted.
+ * TODO: make this virtual for 4.1
* */
Types typeForDeclaration(KDevelop::Declaration* dec, KDevelop::DUContext* context) const;
@@ -142,8 +144,13 @@
//Returns whether the given attribute was set by the code highlighting, and not by something else
//Always returns true when the attribute is zero
bool isCodeHighlight(KTextEditor::Attribute::Ptr attr) const;
+
+ ///TODO: 4.1 - reorder the functions to make more sense, cannot do now without changing ABI
+ protected:
//Can be overridden to create an own instance type
virtual CodeHighlightingInstance* createInstance() const;
+
+ private:
friend class CodeHighlightingInstance;
mutable QHash m_definitionAttributes;
diff -Nru kdevplatform-0.9.98/language/highlighting/colorcache.cpp kdevplatform-1.0.1/language/highlighting/colorcache.cpp
--- kdevplatform-0.9.98/language/highlighting/colorcache.cpp 2010-02-03 09:23:14.000000000 +0000
+++ kdevplatform-1.0.1/language/highlighting/colorcache.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -119,16 +119,10 @@
ColorCache* ColorCache::self()
{
- return m_self;
-}
-
-void ColorCache::initialize()
-{
- if (m_self) {
- return;
+ if (!m_self) {
+ m_self = new ColorCache;
}
-
- m_self = new ColorCache;
+ return m_self;
}
void ColorCache::generateColors()
diff -Nru kdevplatform-0.9.98/language/highlighting/configurablecolors.h kdevplatform-1.0.1/language/highlighting/configurablecolors.h
--- kdevplatform-0.9.98/language/highlighting/configurablecolors.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/highlighting/configurablecolors.h 2010-07-17 19:58:27.000000000 +0100
@@ -27,8 +27,10 @@
#include "codehighlighting.h"
#include "colorcache.h"
+#include "../languageexport.h"
+
namespace KDevelop {
-class ConfigurableHighlightingColors {
+class KDEVPLATFORMLANGUAGE_EXPORT ConfigurableHighlightingColors {
public:
ConfigurableHighlightingColors(QString highlightingName);
diff -Nru kdevplatform-0.9.98/language/interfaces/iquickopen.h kdevplatform-1.0.1/language/interfaces/iquickopen.h
--- kdevplatform-0.9.98/language/interfaces/iquickopen.h 2009-09-05 23:45:19.000000000 +0100
+++ kdevplatform-1.0.1/language/interfaces/iquickopen.h 2010-07-17 19:58:27.000000000 +0100
@@ -55,6 +55,14 @@
virtual ~IQuickOpen();
/**
+ * Shows the quickopen dialog with the entries of specified types
+ * Default types are: Files, Functions, Classes
+ * There might be other quick open providers with custom items.
+ * Note, the item name has to be translated, for example i18n("Files") should be passed.
+ * */
+ virtual void showQuickOpen( const QStringList &types ) = 0;
+
+ /**
* Registers a new provider under a specified name.
* There may be multiple providers with the same type/scope, they will be used simultaneously in that case.
* type and scope will be shown in the GUI, so they should be translated.
diff -Nru kdevplatform-0.9.98/language/util/somehash.cpp kdevplatform-1.0.1/language/util/somehash.cpp
--- kdevplatform-0.9.98/language/util/somehash.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/language/util/somehash.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -289,7 +289,6 @@
u.ptr = key;
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
-// const uint8_t *k8;
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
@@ -333,7 +332,7 @@
#else /* make valgrind happy */
- k8 = (const uint8_t *)k;
+ const uint8_t *k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
@@ -474,7 +473,6 @@
u.ptr = key;
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
-// const uint8_t *k8;
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
@@ -518,7 +516,7 @@
#else /* make valgrind happy */
- k8 = (const uint8_t *)k;
+ const uint8_t *k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
@@ -540,7 +538,6 @@
} else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */
- const uint8_t *k8;
/*--------------- all but last block: aligned reads and different mixing */
while (length > 12)
@@ -554,7 +551,7 @@
}
/*----------------------------- handle the last (probably partial) block */
- k8 = (const uint8_t *)k;
+ const uint8_t *k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[4]+(((uint32_t)k[5])<<16);
@@ -651,7 +648,6 @@
u.ptr = key;
if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
- const uint8_t *k8;
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
@@ -695,7 +691,7 @@
#else /* make valgrind happy */
- k8 = (const uint8_t *)k;
+ const uint8_t *k8 = (const uint8_t *)k;
switch(length) /* all the case statements fall through */
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
diff -Nru kdevplatform-0.9.98/Messages.sh kdevplatform-1.0.1/Messages.sh
--- kdevplatform-0.9.98/Messages.sh 2009-10-17 16:05:46.000000000 +0100
+++ kdevplatform-1.0.1/Messages.sh 2010-07-17 19:58:27.000000000 +0100
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
-subdirs="debugger interfaces kross language outputview project shell sublime util vcs"
+subdirs="debugger interfaces language outputview project shell sublime util vcs"
rcfiles="`find $subdirs -name \*.rc`"
uifiles="`find $subdirs -name \*.ui`"
kcfgfiles="`find $subdirs -name \*.kcfg`"
diff -Nru kdevplatform-0.9.98/outputview/outputjob.cpp kdevplatform-1.0.1/outputview/outputjob.cpp
--- kdevplatform-0.9.98/outputview/outputjob.cpp 2010-01-31 14:59:10.000000000 +0000
+++ kdevplatform-1.0.1/outputview/outputjob.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -86,8 +86,9 @@
}
}
-void OutputJob::outputViewRemoved(int idx, int id)
+void OutputJob::outputViewRemoved(int toolViewId, int id)
{
+ Q_UNUSED(toolViewId);
if (id == m_outputId && m_killJobOnOutputClose)
{
// Make sure that the job emits result signal as the job
diff -Nru kdevplatform-0.9.98/outputview/outputjob.h kdevplatform-1.0.1/outputview/outputjob.h
--- kdevplatform-0.9.98/outputview/outputjob.h 2010-01-31 14:59:10.000000000 +0000
+++ kdevplatform-1.0.1/outputview/outputjob.h 2010-07-17 19:58:27.000000000 +0100
@@ -38,6 +38,10 @@
Q_OBJECT
public:
+ enum
+ {
+ FailedShownError = UserDefinedError + 100 //job failed and failure is shown in OutputView
+ };
enum OutputJobVerbosity { Silent, Verbose };
OutputJob(QObject* parent = 0, OutputJobVerbosity verbosity = OutputJob::Verbose);
diff -Nru kdevplatform-0.9.98/plugins/appwizard/appwizardplugin.cpp kdevplatform-1.0.1/plugins/appwizard/appwizardplugin.cpp
--- kdevplatform-0.9.98/plugins/appwizard/appwizardplugin.cpp 2010-01-16 21:08:24.000000000 +0000
+++ kdevplatform-1.0.1/plugins/appwizard/appwizardplugin.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -195,6 +195,13 @@
return true; // initialization phase complete
}
+QString generateIdentifier( const QString& appname )
+{
+ QString tmp = appname;
+ QRegExp re("[^a-zA-Z0-9_]");
+ return tmp.replace(re, "_");
+}
+
} // end anonymous namespace
QString AppWizardPlugin::createProject(const ApplicationInfo& info)
@@ -225,6 +232,8 @@
m_variables["APPNAME"] = info.name;
m_variables["APPNAMEUC"] = info.name.toUpper();
m_variables["APPNAMELC"] = info.name.toLower();
+ m_variables["APPNAMEID"] = generateIdentifier(info.name);
+ m_variables["PROJECTDIR"] = dest.toLocalFile();
m_variables["PROJECTDIRNAME"] = dest.fileName();
m_variables["VERSIONCONTROLPLUGIN"] = info.vcsPluginName;
@@ -305,11 +314,11 @@
kDebug() << "failed to open template archive";
return QString();
}
-
+
QString projectFileName = QDir::cleanPath( dest.toLocalFile() + '/' + info.name + ".kdev4" );
kDebug() << "Returning" << projectFileName << QFileInfo( projectFileName ).exists() ;
-
+
if( ! QFileInfo( projectFileName ).exists() )
{
kDebug() << "creating .kdev4 file";
@@ -317,8 +326,8 @@
KConfigGroup project = cfg->group( "Project" );
project.writeEntry( "Name", info.name );
QString manager = "KDevGenericManager";
-
- QDir d( dest.toLocalFile() );
+
+ QDir d( dest.toLocalFile() );
foreach(const KPluginInfo& info, KDevelop::IPluginController::queryExtensionPlugins( "org.kdevelop.IProjectFileManager" ) )
{
QVariant filter = info.property("X-KDevelop-ProjectFilesFilter");
@@ -337,7 +346,7 @@
KConfigGroup project2 = cfg->group( "Project" );
kDebug() << "kdev4 file contents:" << project2.readEntry("Name", "") << project2.readEntry("Manager", "" );
}
-
+
return projectFileName;
}
diff -Nru kdevplatform-0.9.98/plugins/appwizard/kdevappwizard.desktop kdevplatform-1.0.1/plugins/appwizard/kdevappwizard.desktop
--- kdevplatform-0.9.98/plugins/appwizard/kdevappwizard.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/appwizard/kdevappwizard.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,6 +6,8 @@
Comment[bg]=Съветник на приложение
Comment[ca]=Assistent d'aplicació
Comment[ca@valencia]=Assistent d'aplicació
+Comment[cs]=Průvodce aplikací
+Comment[da]=Applikationsguide
Comment[de]=Anwendungsassistent
Comment[en_GB]=Application Wizard
Comment[es]=Asistente de aplicaciones
@@ -13,12 +15,16 @@
Comment[fr]=Assistant d'applications
Comment[ga]=Treoraí Feidhmchláir
Comment[gl]=Asistente para programas
+Comment[it]=Procedura guidata applicazione
Comment[ja]=アプリケーションウィザード
Comment[nb]=Programveiviser
Comment[nds]=Programm-Hölper
+Comment[nl]=Programma-assistent
+Comment[pl]=Asystent programu
Comment[pt]=Assistente de Aplicações
Comment[pt_BR]=Assistente de aplicativo
Comment[ru]=Мастер создания приложений
+Comment[sl]=Čarovnik za program
Comment[sv]=Programguide
Comment[tr]=Uygulama Sihirbazı
Comment[uk]=Майстер створення програм
@@ -29,19 +35,24 @@
Name[bg]=Съветник за нов проект
Name[ca]=Assistent de nou projecte
Name[ca@valencia]=Assistent de nou projecte
+Name[cs]=Průvodce novým projektem
+Name[da]=Guide til nyt projekt
Name[de]=Projekt-Assistent
Name[en_GB]=New Project Wizard
Name[es]=Asistente de nuevo proyecto
Name[et]=Uue projekti nõustaja
Name[fr]=Assistant de création de nouveau projet
Name[gl]=Asistente para proxectos novos
+Name[it]=Procedura guidata nuovo progetto
Name[ja]=新規プロジェクト作成ウィザード
Name[nb]=Veiviser for nytt prosjekt
-Name[nds]=Nieg-Projekt-Hölper
+Name[nds]=Projekt-Hölper
Name[nl]=Nieuwe projectenassistent
+Name[pl]=Asystent nowego projektu
Name[pt]=Assistente de Novos Projectos
Name[pt_BR]=Assistente de novo projeto
Name[ru]=Мастер создания проекта
+Name[sl]=Čarovnik za nov projekt
Name[sv]=Ny projektguide
Name[tr]=Yeni Proje Sihirbazı
Name[uk]=Майстер створення проекту
@@ -52,6 +63,8 @@
GenericName[bg]=Съветник на приложение
GenericName[ca]=Assistent d'aplicació
GenericName[ca@valencia]=Assistent d'aplicació
+GenericName[cs]=Průvodce aplikací
+GenericName[da]=Applikationsguide
GenericName[de]=Anwendungsassistent
GenericName[en_GB]=Application Wizard
GenericName[es]=Asistente de aplicaciones
@@ -59,13 +72,16 @@
GenericName[fr]=Assistant d'applications
GenericName[ga]=Treoraí Feidhmchláir
GenericName[gl]=Asistente para programas
+GenericName[it]=Procedura guidata applicazione
GenericName[ja]=アプリケーションウィザード
GenericName[nb]=Programveiviser
GenericName[nds]=Programm-Hölper
GenericName[nl]=Programma-assistent
+GenericName[pl]=Asystent programu
GenericName[pt]=Assistente de Aplicações
GenericName[pt_BR]=Assistente de aplicativo
GenericName[ru]=Мастер создания приложений
+GenericName[sl]=Čarovnik za program
GenericName[sv]=Programguide
GenericName[tr]=Uygulama Sihirbazı
GenericName[uk]=Майстер створення програм
@@ -79,5 +95,5 @@
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-License=GPL
X-KDevelop-Category=Global
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/appwizard/projectselectionpage.cpp kdevplatform-1.0.1/plugins/appwizard/projectselectionpage.cpp
--- kdevplatform-0.9.98/plugins/appwizard/projectselectionpage.cpp 2010-01-08 16:19:26.000000000 +0000
+++ kdevplatform-1.0.1/plugins/appwizard/projectselectionpage.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -23,6 +23,7 @@
#include "ui_projectselectionpage.h"
#include "projecttemplatesmodel.h"
#include "appwizardplugin.h"
+#include
ProjectSelectionPage::ProjectSelectionPage(ProjectTemplatesModel *templatesModel, QWidget *parent)
: AppWizardPageWidget(parent), m_templatesModel(templatesModel)
@@ -34,7 +35,7 @@
ui->locationUrl->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
ui->locationUrl->setUrl(KDevelop::ICore::self()->projectController()->projectsBaseDirectory());
- ui->locationValidLabel->setText(QString());
+ ui->locationValidLabel->setText(QString(" "));
connect( ui->locationUrl->lineEdit(), SIGNAL(textEdited(const QString&)),
this, SLOT(urlEdited() ));
@@ -99,12 +100,20 @@
emit locationChanged( location() );
}
+void setForeground(QLabel* label, KColorScheme::ForegroundRole role)
+{
+ QPalette p = label->palette();
+ KColorScheme::adjustForeground(p, role, label->foregroundRole(), KColorScheme::Window);
+ label->setPalette(p);
+}
+
void ProjectSelectionPage::validateData()
{
KUrl url = ui->locationUrl->url();
if( !url.isLocalFile() || url.isEmpty() )
{
ui->locationValidLabel->setText( i18n("Invalid location") );
+ setForeground(ui->locationValidLabel, KColorScheme::NegativeText);
emit invalid();
return;
}
@@ -112,6 +121,7 @@
if( appName().isEmpty() )
{
ui->locationValidLabel->setText( i18n("Empty project name") );
+ setForeground(ui->locationValidLabel, KColorScheme::NegativeText);
emit invalid();
return;
}
@@ -119,6 +129,7 @@
if( appName() == "." || appName() == "..")
{
ui->locationValidLabel->setText( i18n("Invalid project name") );
+ setForeground(ui->locationValidLabel, KColorScheme::NegativeText);
emit invalid();
return;
}
@@ -134,6 +145,7 @@
{
ui->locationValidLabel->setText( i18n("Unable to create subdirectories, "
"missing permissions on: %1", tDir.absolutePath()) );
+ setForeground(ui->locationValidLabel, KColorScheme::NegativeText);
emit invalid();
return;
}
@@ -142,11 +154,13 @@
QStandardItem* item = m_templatesModel->itemFromIndex( ui->templateView->currentIndex() );
if( item && !item->hasChildren() )
{
- ui->locationValidLabel->setText( QString() );
+ ui->locationValidLabel->setText( QString(" ") );
+ setForeground(ui->locationValidLabel, KColorScheme::NormalText);
emit valid();
} else
{
ui->locationValidLabel->setText( i18n("Invalid project template, please choose a leaf item") );
+ setForeground(ui->locationValidLabel, KColorScheme::NegativeText);
emit invalid();
return;
}
@@ -159,6 +173,7 @@
if( !QDir( fi.absoluteFilePath()).entryList( QDir::NoDotAndDotDot | QDir::AllEntries ).isEmpty() )
{
ui->locationValidLabel->setText( i18n("Path already exists and contains files") );
+ setForeground(ui->locationValidLabel, KColorScheme::NegativeText);
}
}
}
diff -Nru kdevplatform-0.9.98/plugins/appwizard/projectselectionpage.ui kdevplatform-1.0.1/plugins/appwizard/projectselectionpage.ui
--- kdevplatform-0.9.98/plugins/appwizard/projectselectionpage.ui 2009-03-24 00:16:00.000000000 +0000
+++ kdevplatform-1.0.1/plugins/appwizard/projectselectionpage.ui 2010-07-17 19:58:27.000000000 +0100
@@ -1,7 +1,8 @@
-
+
+
ProjectSelectionPage
-
-
+
+
0
0
@@ -9,76 +10,80 @@
475
-
- -
-
+
+
-
+
- -
-
-
+
-
+
+
250
150
-
+
-
+
Qt::AlignCenter
- -
-
-
+
-
+
+
250
150
-
+
-
+
Qt::AlignCenter
- -
-
-
+
-
+
+
Properties
-
-
+
+
9
-
+
6
-
-
-
+
-
+
- -
-
-
+
-
+
+
Location:
- -
-
-
+
-
+
+
Application Name:
- -
-
+
-
+
+
+
+
+
- -
-
+
-
+
@@ -87,15 +92,15 @@
- KSqueezedTextLabel
- QLabel
-
-
-
KUrlRequester
QFrame
+
+ KSqueezedTextLabel
+ QLabel
+
+
templateView
diff -Nru kdevplatform-0.9.98/plugins/classbrowser/classwidget.cpp kdevplatform-1.0.1/plugins/classbrowser/classwidget.cpp
--- kdevplatform-0.9.98/plugins/classbrowser/classwidget.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/classbrowser/classwidget.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#include
@@ -53,6 +54,8 @@
// Set model in the tree view
m_tree->setModel(m_model);
+ m_tree->header()->setResizeMode(0, QHeaderView::ResizeToContents);
+ m_tree->header()->setStretchLastSection(false);
// We need notification in the model for the collapse/expansion of nodes.
connect(m_tree, SIGNAL(collapsed(const QModelIndex&)),
diff -Nru kdevplatform-0.9.98/plugins/classbrowser/kdevclassbrowser.desktop kdevplatform-1.0.1/plugins/classbrowser/kdevclassbrowser.desktop
--- kdevplatform-0.9.98/plugins/classbrowser/kdevclassbrowser.desktop 2010-01-31 10:59:04.000000000 +0000
+++ kdevplatform-1.0.1/plugins/classbrowser/kdevclassbrowser.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,6 +6,7 @@
Comment[bg]=Тази приставка дава модел за разглеждане на вече синтактично изгладени класове и други параграфи.
Comment[ca]=Aquest connector proporciona un model navegable de les classes analitzades actualment i altres elements.
Comment[ca@valencia]=Este connector proporciona un model navegable de les classes analitzades actualment i altres elements.
+Comment[da]=Dette plugin tilbyder en model der kan gennemses for de fortolkede klasser og andre elementer.
Comment[de]=Dieses Modul bietet eine Liste der aktuell eingelesenen Klassen und anderer Elemente.
Comment[el]=Αυτό το πρόσθετο προσφέρει ένα μοντέλο περιήγησης των αναλυμένων κλάσεων και άλλων αντικειμένων.
Comment[en_GB]=This plugin provides a browsable model of the currently parsed classes and other items.
@@ -13,10 +14,14 @@
Comment[et]=See plugin pakub parajasti parsitavate klasside ja teiste elementide sirvitavat mudelit.
Comment[fr]=Ce module externe fournit un modèle navigable des classes et autres éléments dont l'analyse syntaxique est en cours.
Comment[gl]=Este engadido fornece un modelo navegábel das clases e outros elementos que estean procesados.
+Comment[it]=Questa estensione fornisce un modello sfogliabile delle classi attualmete analizzate e altri elementi.
Comment[nb]=Dette programtillegget gir en modell som det går an å bla i, av de klassene som er tolket og ande elementer.
Comment[nds]=Dit Moduul stellt en dörkiekbor Modell vun de opstunns inleesten Klassen un anner Objekten praat.
+Comment[nl]=Deze plugin levert een model om door te bladeren van de nu ontlede klasse's en andere items.
+Comment[pl]=Ta wtyczka udostępnia możliwy do przeglądania model przeanalizowanych klas i innych elementów.
Comment[pt]=Este 'plugin' oferece um modelo navegável pelas classes e outros itens processados neste momento.
Comment[pt_BR]=Esta extensão provê um modelo navegável das classes atualmente analisadas e outros itens.
+Comment[sl]=Vstavek prinaša model trenutno razčlenjenih razredov in drugih struktur, po katerih je moč brskati.
Comment[sv]=Insticksprogrammet tillhandahåller en bläddringsbar modell av klasser och andra objekt som för närvarande har tolkats.
Comment[uk]=За допомогою цього додатка можна створити придатну для перегляду модель класів та інших елементів, над якими ви працюєте.
Comment[x-test]=xxThis plugin provides a browsable model of the currently parsed classes and other items.xx
@@ -26,18 +31,23 @@
Name[bg]=KDevClassBrowser
Name[ca]=KDevClassBrowser
Name[ca@valencia]=KDevClassBrowser
+Name[da]=KDevClassBrowser
Name[de]=KDevClassBrowser
Name[el]=KDevClassBrowser
Name[en_GB]=KDevClassBrowser
Name[es]=KDevClassBrowser
Name[et]=KDevClassBrowser
Name[fr]=KDevClassBrowser
+Name[ga]=KDevClassBrowser
Name[gl]=KDevClassBrowser
+Name[it]=KDevClassBrowser
Name[nb]=KDevClassBrowser
Name[nds]=KDev-Klassenkieker
Name[nl]=KDevClassBrowser
+Name[pl]=KDevClassBrowser
Name[pt]=KDevClassBrowser
Name[pt_BR]=KDevClassBrowser
+Name[sl]=KDevClassBrowser
Name[sv]=KDevelop-klassbläddrare
Name[tr]=KDevClassBrowser
Name[uk]=KDevClassBrowser
@@ -48,6 +58,8 @@
GenericName[bg]=Браузър за класове
GenericName[ca]=Navegador de classes
GenericName[ca@valencia]=Navegador de classes
+GenericName[cs]=Prohlížeč tříd
+GenericName[da]=Klassebrowser
GenericName[de]=Klassen-Browser
GenericName[el]=Περιηγητής κλάσεων
GenericName[en_GB]=Class Browser
@@ -55,14 +67,18 @@
GenericName[et]=Klassibrauser
GenericName[fr]=Navigateur de classes
GenericName[gl]=Navegador de clases
+GenericName[it]=Browser classi
+GenericName[ja]=クラスブラウザ
GenericName[lv]=Klašu pārlūks
GenericName[nb]=Klasseleser
GenericName[nds]=Klassenkieker
GenericName[nl]=Klassenbrowser
GenericName[pa]=ਕਲਾਸ ਬਰਾਊਜ਼ਰ
+GenericName[pl]=Przeglądarka klas
GenericName[pt]=Navegador de Classes
GenericName[pt_BR]=Navegador de classes
GenericName[ro]=Navigator de clase
+GenericName[sl]=Brskalnik po razredih
GenericName[sv]=Klassbläddrare
GenericName[tr]=Sınıf Tarayıcı
GenericName[uk]=Переглядач класів
@@ -71,7 +87,7 @@
GenericName[zh_TW]=類別瀏覽器
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevclassbrowser
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDE-PluginInfo-Name=kdevclassbrowser
X-KDE-PluginInfo-Author=Hamish Rodda
diff -Nru kdevplatform-0.9.98/plugins/contextbrowser/browsemanager.cpp kdevplatform-1.0.1/plugins/contextbrowser/browsemanager.cpp
--- kdevplatform-0.9.98/plugins/contextbrowser/browsemanager.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/contextbrowser/browsemanager.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -216,7 +216,7 @@
foundDeclaration = DUChainUtils::declarationForDefinition( DUChainUtils::itemUnderCursor(view->document()->url(), SimpleCursor(textCursor)) );
if(foundDeclaration && foundDeclaration->url().toUrl().equals(view->document()->url()) && foundDeclaration->range().contains(SimpleCursor(textCursor))) {
- ///A declaration was clicked directory. Jumping to it is useless, so jump to the definition or something useful
+ ///A declaration was clicked directly. Jumping to it is useless, so jump to the definition or something useful
bool foundBetter = false;
diff -Nru kdevplatform-0.9.98/plugins/contextbrowser/contextbrowser.cpp kdevplatform-1.0.1/plugins/contextbrowser/contextbrowser.cpp
--- kdevplatform-0.9.98/plugins/contextbrowser/contextbrowser.cpp 2010-01-16 14:04:41.000000000 +0000
+++ kdevplatform-1.0.1/plugins/contextbrowser/contextbrowser.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -62,7 +62,6 @@
#include
#include
#include
-#include
const unsigned int highlightingTimeout = 150;
@@ -169,12 +168,14 @@
ContextBrowserPlugin::ContextBrowserPlugin(QObject *parent, const QVariantList&)
: KDevelop::IPlugin(ContextBrowserFactory::componentData(), parent)
- , m_backupsMutex(QMutex::Recursive), m_viewFactory(new ContextBrowserViewFactory(this))
+ , m_backupsMutex(QMutex::Recursive)
+ , m_viewFactory(new ContextBrowserViewFactory(this)), m_lastInsertionDocument(0)
{
core()->uiController()->addToolView(i18n("Code Browser"), m_viewFactory);
connect( core()->documentController(), SIGNAL( textDocumentCreated( KDevelop::IDocument* ) ), this, SLOT( textDocumentCreated( KDevelop::IDocument* ) ) );
connect( core()->documentController(), SIGNAL( documentClosed( KDevelop::IDocument* ) ), this, SLOT( documentClosed( KDevelop::IDocument* ) ) );
+ connect( core()->documentController(), SIGNAL( documentActivated( KDevelop::IDocument* ) ), this, SLOT( documentActivated( KDevelop::IDocument* ) ) );
connect( core()->languageController()->backgroundParser(), SIGNAL(parseJobFinished(KDevelop::ParseJob*)), this, SLOT(parseJobFinished(KDevelop::ParseJob*)));
connect( DUChain::self(), SIGNAL( declarationSelected(DeclarationPointer) ), this, SLOT( declarationSelectedInUI(DeclarationPointer) ) );
@@ -393,31 +394,33 @@
m_mouseHoverDocument.clear();
}
-
Attribute::Ptr highlightedUseAttribute(bool /*mouseHighlight*/, bool bold) {
if(bold) {
static Attribute::Ptr standardBoldAttribute = Attribute::Ptr();
if( !standardBoldAttribute ) {
standardBoldAttribute= Attribute::Ptr( new Attribute() );
standardBoldAttribute->setBackgroundFillWhitespace(true);
-
- standardBoldAttribute->setBackground(QColor(255, 255, 0, 100));//QApplication::palette().toolTipBase());
+
+ // mixing (255, 255, 0, 100) with white yields this:
+ standardBoldAttribute->setBackground(QColor(251, 250, 150));
standardBoldAttribute->setFontBold(true);
+
+ // force a foreground color to overwrite default Kate highlighting, i.e. of Q_OBJECT or similar
+ // foreground color could change, hence apply it everytime
+ standardBoldAttribute->setForeground(QColor(0, 0, 0, 255)); //Don't use alpha here, as kate uses the alpha only to blend with the document background color
}
- // force a foreground color to overwrite default Kate highlighting, i.e. of Q_OBJECT or similar
- // foreground color could change, hence apply it everytime
- standardBoldAttribute->setForeground(ColorCache::self()->foregroundColor());
return standardBoldAttribute;
}else{
static Attribute::Ptr standardAttribute = Attribute::Ptr();
if( !standardAttribute ) {
standardAttribute = Attribute::Ptr( new Attribute() );
standardAttribute->setBackgroundFillWhitespace(true);
- standardAttribute->setBackground(QColor(255, 255, 0, 100));//QApplication::palette().toolTipBase());
+ // mixing (255, 255, 0, 100) with white yields this:
+ standardAttribute->setBackground(QColor(251, 250, 150));
+ // force a foreground color to overwrite default Kate highlighting, i.e. of Q_OBJECT or similar
+ // foreground color could change, hence apply it everytime
+ standardAttribute->setForeground(QColor(0, 0, 0, 255)); //Don't use alpha here, as kate uses the alpha only to blend with the document background color
}
- // force a foreground color to overwrite default Kate highlighting, i.e. of Q_OBJECT or similar
- // foreground color could change, hence apply it everytime
- standardAttribute->setForeground(ColorCache::self()->foregroundColor());
return standardAttribute;
}
}
@@ -440,11 +443,12 @@
if( !standardAttribute ) {
standardAttribute = Attribute::Ptr( new Attribute() );
standardAttribute->setBackgroundFillWhitespace(true);
- standardAttribute->setBackground(QColor(90, 255, 0, 100));//QApplication::palette().toolTipBase());
+ // mixing (90, 255, 0, 100) with white yields this:
+ standardAttribute->setBackground(QColor(190, 255, 155));
+ // force a foreground color to overwrite default Kate highlighting, i.e. of Q_OBJECT or similar
+ // foreground color could change, hence apply it everytime
+ standardAttribute->setForeground(QColor(0, 0, 0, 255)); //Don't use alpha here, as kate uses the alpha only to blend with the document background color
}
- // force a foreground color to overwrite default Kate highlighting, i.e. of Q_OBJECT or similar
- // foreground color could change, hence apply it everytime
- standardAttribute->setForeground(ColorCache::self()->foregroundColor());
return standardAttribute;
}
@@ -814,6 +818,14 @@
{
}
+void ContextBrowserPlugin::documentActivated( IDocument* doc )
+{
+ if (doc->textDocument() && doc->textDocument()->activeView())
+ {
+ cursorPositionChanged(doc->textDocument()->activeView(), doc->textDocument()->activeView()->cursorPosition());
+ }
+}
+
void ContextBrowserPlugin::documentDestroyed( QObject* /*obj*/ )
{
}
@@ -936,7 +948,7 @@
KDevVarLengthArray usingFiles = DUChain::uses()->uses(decl->id());
if(DUChainUtils::contextHasUse(decl->topContext(), decl) && usingFiles.indexOf(decl->topContext()) == -1)
- usingFiles.insert(decl->topContext(), 0);
+ usingFiles.insert(0, decl->topContext());
if(decl->range().contains(c) && decl->url() == chosen->url()) {
//The cursor is directly on the declaration. Jump to the first or last use.
diff -Nru kdevplatform-0.9.98/plugins/contextbrowser/contextbrowser.h kdevplatform-1.0.1/plugins/contextbrowser/contextbrowser.h
--- kdevplatform-0.9.98/plugins/contextbrowser/contextbrowser.h 2009-10-30 22:24:57.000000000 +0000
+++ kdevplatform-1.0.1/plugins/contextbrowser/contextbrowser.h 2010-07-17 19:58:27.000000000 +0100
@@ -86,6 +86,7 @@
void parseJobFinished(KDevelop::ParseJob* job);
void textDocumentCreated( KDevelop::IDocument* document );
void documentClosed( KDevelop::IDocument* document );
+ void documentActivated( KDevelop::IDocument* );
void documentDestroyed( QObject* obj );
void viewDestroyed( QObject* obj );
void cursorPositionChanged( KTextEditor::View* view, const KTextEditor::Cursor& newPosition );
diff -Nru kdevplatform-0.9.98/plugins/contextbrowser/contextbrowserview.cpp kdevplatform-1.0.1/plugins/contextbrowser/contextbrowserview.cpp
--- kdevplatform-0.9.98/plugins/contextbrowser/contextbrowserview.cpp 2010-02-10 14:08:23.000000000 +0000
+++ kdevplatform-1.0.1/plugins/contextbrowser/contextbrowserview.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -504,6 +504,7 @@
m_toolbarWidgetLayout->addWidget(m_previousButton);
m_toolbarWidgetLayout->addWidget(m_outlineLine);
+ m_outlineLine->setMaximumWidth(600);
m_toolbarWidgetLayout->addWidget(m_nextButton);
m_toolbarWidgetLayout->addWidget(m_browseButton);
@@ -515,6 +516,8 @@
m_buttons->addWidget(m_lockButton);
m_layout = new QVBoxLayout;
+ m_layout->setSpacing(0);
+ m_layout->setMargin(0);
m_layout->addLayout(m_buttons);
m_layout->addWidget(m_navigationWidget);
//m_layout->addStretch();
diff -Nru kdevplatform-0.9.98/plugins/contextbrowser/kdevcontextbrowser.desktop kdevplatform-1.0.1/plugins/contextbrowser/kdevcontextbrowser.desktop
--- kdevplatform-0.9.98/plugins/contextbrowser/kdevcontextbrowser.desktop 2010-02-06 09:59:13.000000000 +0000
+++ kdevplatform-1.0.1/plugins/contextbrowser/kdevcontextbrowser.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,6 +6,7 @@
Comment[bg]=Този приставка показва информация за текущата езикова настройка погледната отвън и маркира съответните декларации и употреби.
Comment[ca]=Aquest connector mostra informació quant al context del llenguatge actual en una vista lateral i ressalta les declaracions i els usos rellevants.
Comment[ca@valencia]=Este connector mostra informació quant al context del llenguatge actual en una vista lateral i ressalta les declaracions i els usos rellevants.
+Comment[da]=Dette plugin viser information om den sprogkontekst i et sidepanel og fremhæver relevante erklæringer og brug.
Comment[de]=Dieses Modul zeigt Informationen über den aktuellen Sprachkontext an und hebt die wichtigen Deklarationen und Vorkommen hervor.
Comment[el]=Αυτό το πρόσθετο εμφανίζει πληροφορίες σχετικά με την τρέχουσα γλώσσα σε μια πλευρική προβολή, και τονίζει τις σχετικές δηλώσεις και χρήσεις.
Comment[en_GB]=This plugin shows information about the current language context in a side view, and highlights relevant declarations and uses.
@@ -13,10 +14,14 @@
Comment[et]=See plugin pakub külgvaates teavet aktiivse keele konteksti kohta ning tõstab esile asjakohased deklaratsioonid ja kasutused.
Comment[fr]=Ce module externe affiche des informations sur le contexte du langage actuel dans une vue latérale, et met en surbrillance les déclarations et utilisations pertinentes.
Comment[gl]=Este engadido mostra información acerca do contexto da linguaxe actual nunha vista lateral, e realza as declaracións e utilizacións relevantes.
+Comment[it]=Questa estensione mostra le informazioni sul contesto del linguaggio corrente in una vista laterale, mettendo in evidenza le dichiarazioni e gli usi.
Comment[nb]=Dette programtillegget viser informasjon om gjeldende språkkontekst i et sidevindu, og fremhever relevante deklarasjoner og bruk.
Comment[nds]=Dit Moduul wiest binnen en Sietpaneel Informatschonen över den aktuellen Spraakkontext un heevt wichtig Deklaratschonen un Bruken rut.
+Comment[nl]=Deze plugin toont informatie over de huidige taalcontext in een zijvak en accentueert relevante declaraties en gebruik.
+Comment[pl]=Ta wtyczka pokazuje informacje dotyczące kontekstu bieżącego języka w widoku bocznym, podświetla deklaracja i ich użycia.
Comment[pt]=Este 'plugin' mostra informações sobre o contexto actual da linguagem numa visão lateral, realçando as declarações e utilizações relevantes.
Comment[pt_BR]=Esta extensão mostra informações sobre a linguagem utilizada no momento, numa visão lateral, e destaca declarações relevantes e seus usos.
+Comment[sl]=Vstavek prikazuje podatke o trenutnem kontekstu in poudari pomembne deklaracije in uporabe.
Comment[sv]=Insticksprogrammet visar information om nuvarande språksammanhang i en sidovy, och markerar relevanta deklarationer och användningar.
Comment[uk]=За допомогою цього додатка можна переглянути у перегляді на бічній панелі відомості про поточний контекст мови, а також підсвітити пов’язані оголошення і випадки використання.
Comment[x-test]=xxThis plugin shows information about the current language context in a side view, and highlights relevant declarations and uses.xx
@@ -26,6 +31,8 @@
Name[bg]=Браузър за низове
Name[ca]=Navegador de codi
Name[ca@valencia]=Navegador de codi
+Name[cs]=Prohlížeč kódu
+Name[da]=Kodebrowser
Name[de]=Quelltext-Browser
Name[el]=Περιηγητής κώδικα
Name[en_GB]=Code Browser
@@ -33,14 +40,17 @@
Name[et]=Koodibrauser
Name[fr]=Navigateur de code
Name[gl]=Navegador do código
+Name[it]=Browser del codice
Name[ja]=コードブラウザ
Name[nb]=Kodeleser
Name[nds]=Kodekieker
Name[nl]=Broncode-browser
Name[pa]=ਕੋਡ ਬਰਾਊਜ਼ਰ
+Name[pl]=Przeglądarka kodu
Name[pt]=Navegador do Código
Name[pt_BR]=Navegador de código
Name[ru]=Просмотр кода
+Name[sl]=Brskalnik po kodi
Name[sv]=Kodbläddrare
Name[tr]=Kod Tarayıcı
Name[uk]=Переглядач коду
@@ -51,17 +61,22 @@
GenericName[bg]=Инструмент за управление на низове
GenericName[ca]=Eina de navegació de codi
GenericName[ca@valencia]=Eina de navegació de codi
+GenericName[da]=Værktøj til kodenavigation
GenericName[de]=Werkzeug zur Quelltextnavigation
GenericName[en_GB]=Code Navigation Tool
GenericName[es]=Herramienta de navegación por el código
GenericName[et]=Koodi liikumistööriist
GenericName[fr]=Outil de navigation de code
GenericName[gl]=Utilidade de navegación polo código
+GenericName[it]=Strumento di navigazione del codice
GenericName[nb]=Kodenavigeringsverktøy
GenericName[nds]=Kode-Navigatschoon
+GenericName[nl]=Hulpmiddel voor navigatie door code
+GenericName[pl]=Narzędzie do nawigacji w kodzie
GenericName[pt]=Ferramenta de Navegação do Código
GenericName[pt_BR]=Ferramenta de navegação de código
GenericName[ru]=Инструмент навигации по коду
+GenericName[sl]=Orodje za krmarjenje po kodi
GenericName[sv]=Kodnavigeringsverktyg
GenericName[tr]=Kod Tarama Eklentisi
GenericName[uk]=Інструмент навігації кодом
@@ -70,7 +85,7 @@
GenericName[zh_TW]=源碼導覽工具
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevcontextbrowser
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDE-PluginInfo-Name=kdevcontextbrowser
X-KDE-PluginInfo-Author=David Nolden
diff -Nru kdevplatform-0.9.98/plugins/cvs/cvsdiffjob.cpp kdevplatform-1.0.1/plugins/cvs/cvsdiffjob.cpp
--- kdevplatform-0.9.98/plugins/cvs/cvsdiffjob.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/cvs/cvsdiffjob.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -25,6 +25,7 @@
QVariant CvsDiffJob::fetchResults()
{
KDevelop::VcsDiff diff;
+ diff.setBaseDiff(KUrl("/"));
diff.setDiff( output() );
diff -Nru kdevplatform-0.9.98/plugins/cvs/cvsplugin.cpp kdevplatform-1.0.1/plugins/cvs/cvsplugin.cpp
--- kdevplatform-0.9.98/plugins/cvs/cvsplugin.cpp 2009-09-13 23:41:44.000000000 +0100
+++ kdevplatform-1.0.1/plugins/cvs/cvsplugin.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -193,12 +193,8 @@
if (!hasVersionControlledEntries)
return IPlugin::contextMenuExtension(context);
- QMenu* menu = new QMenu("CVS");
- QList commonActions = d->m_common->commonActions();
- if (!commonActions.empty()) {
- menu->addActions(commonActions);
- menu->addSeparator();
- }
+ QMenu* menu = d->m_common->commonActions();
+ menu->addSeparator();
KAction *action;
// Just add actions which are not covered by the cvscommon plugin
@@ -215,7 +211,7 @@
menu->addAction(action);
KDevelop::ContextMenuExtension menuExt;
- menuExt.addAction(KDevelop::ContextMenuExtension::ExtensionGroup, menu->menuAction());
+ menuExt.addAction(KDevelop::ContextMenuExtension::VcsGroup, menu->menuAction());
return menuExt;
}
diff -Nru kdevplatform-0.9.98/plugins/cvs/kdevcvs.desktop kdevplatform-1.0.1/plugins/cvs/kdevcvs.desktop
--- kdevplatform-0.9.98/plugins/cvs/kdevcvs.desktop 2010-01-19 12:39:48.000000000 +0000
+++ kdevplatform-1.0.1/plugins/cvs/kdevcvs.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,6 +6,7 @@
Comment[bg]=Тaзи приставка вгражда CVS в KDevelop
Comment[ca]=Aquest connector integra CVS en KDevelop
Comment[ca@valencia]=Este connector integra CVS en KDevelop
+Comment[da]=Dette plugin integrerer CVS med KDevelop
Comment[de]=Dieses Modul integriert CVS in KDevelop.
Comment[el]=Το πρόσθετο αυτό ενσωματώνει το CVS στο KDevelop
Comment[en_GB]=This plugin integrates CVS to KDevelop
@@ -13,14 +14,18 @@
Comment[et]=See plugin lõimib CVS-i KDeveloppi
Comment[fr]=Ce module externe intègre CVS à KDevelop
Comment[gl]=Este engadido integra CVS en KDevelop
+Comment[it]=Questa estensione integra CVS in KDevelop
Comment[ja]=このプラグインは CVS を KDevelop に統合します
Comment[lv]=Šis spraudnis integrē CVS iekš KDevelop
Comment[nb]=Dette programtillegget integrerer CVS i KDevelop
Comment[nds]=Dit Moduul bett CVS na KDevelop in.
+Comment[nl]=Deze plugin integreert CVS in KDevelop
+Comment[pl]=Ta wtyczka udostępnia obsługę CVS w KDevelopie
Comment[pt]=Este 'plugin' integra o CVS no KDevelop
Comment[pt_BR]=Esta extensão integra o CVS ao KDevelop
Comment[ro]=Acest modul integrează CVS în KDevelop
Comment[ru]=Этот модуль добавляет поддержку работы с CVS в KDevelop
+Comment[sl]=Vstavek v KDevelop integrira CVS
Comment[sv]=Insticksprogrammet integrerar CVS i KDevelop
Comment[tr]=Bu eklenti CVS uygulamasını KDevelop ile bütünleştirir
Comment[uk]=За допомогою цього додатка можна інтегрувати CVS до KDevelop
@@ -32,6 +37,7 @@
Name[ca]=Implementació de CVS
Name[ca@valencia]=Implementació de CVS
Name[cs]=Podpora CVS
+Name[da]=CVS-understøttelse
Name[de]=CVS-Unterstützung
Name[el]=Υποστήριξη CVS
Name[en_GB]=CVS Support
@@ -40,13 +46,17 @@
Name[fr]=Prise en charge de CVS
Name[ga]=Tacaíocht CVS
Name[gl]=Soporte de CVS
+Name[it]=Supporto CVS
Name[ja]=CVS サポート
Name[nb]=CVS-støtte
Name[nds]=CVS-Ünnerstütten
+Name[nl]=CVS-ondersteuning
Name[pa]=CVS ਸਹਿਯੋਗ
+Name[pl]=Obsługa CVS
Name[pt]=Suporte para CVS
-Name[pt_BR]=Suporte a CSV
+Name[pt_BR]=Suporte a CVS
Name[ru]=Поддержка CVS
+Name[sl]=Podpora za CVS
Name[sv]=Stöd för CVS
Name[tr]=CVS Desteği
Name[uk]=Підтримка CVS
@@ -57,18 +67,23 @@
GenericName[bg]=Поддръжка на управление на версиите
GenericName[ca]=Implementació del control de versions
GenericName[ca@valencia]=Implementació del control de versions
+GenericName[da]=Understøttelse af versionstyring
GenericName[de]=Unterstützung für Versionskontrollsysteme
GenericName[en_GB]=Version Control Support
GenericName[es]=Implementación de Control de Versiones
GenericName[et]=Versioonihalduse toetus
GenericName[fr]=Prise en charge du contrôle de versions
GenericName[gl]=Soporte de sistemas de versións
+GenericName[it]=Supporto controllo versione
GenericName[ja]=バージョン管理のサポート
GenericName[nb]=Støtte for versjonskontroll
GenericName[nds]=Verschoonkuntrull-Ünnerstütten
+GenericName[nl]=Ondersteuning voor versiecontrole
+GenericName[pl]=Obsługa kontroli wersji
GenericName[pt]=Suporte ao Controlo de Versões
GenericName[pt_BR]=Suporte a controle de versão
GenericName[ru]=Поддержка систем контроля версий
+GenericName[sl]=Podpora za nadzor različic
GenericName[sv]=Stöd för versionskontroll
GenericName[tr]=Sürüm Kontrol Desteği
GenericName[uk]=Підтримка керування версіями
@@ -81,7 +96,7 @@
X-KDE-PluginInfo-Author=Robert Gruber
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-License=GPL
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-Interfaces=org.kdevelop.IBasicVersionControl
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/documentswitcher/kdevdocumentswitcher.desktop kdevplatform-1.0.1/plugins/documentswitcher/kdevdocumentswitcher.desktop
--- kdevplatform-0.9.98/plugins/documentswitcher/kdevdocumentswitcher.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/documentswitcher/kdevdocumentswitcher.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,17 +6,22 @@
Comment[bg]=Последен използван превключвател на документи за KDevPlatform.
Comment[ca]=Un commutador del document usat més recentment per KDevPlatform.
Comment[ca@valencia]=Un commutador del document usat més recentment per KDevPlatform.
+Comment[da]=En dokumentskifter til nyligt anvendte til KDevPlatform.
Comment[de]=Ein Umschalter zwischen zuletzt geöffneten Dokumenten.
Comment[en_GB]=A most-recently-used document switcher for KDevPlatform.
Comment[es]=Un cambiador del documento usado más recientemente para KDevPlatform.
Comment[et]=KDevPlatformi viimati kasutatud dokumentide vahetaja
Comment[fr]=Un commutateur de documents parmi les plus récemment utilisés pour KDevPlatform.
Comment[gl]=Un selector entre documentos empregados recentemente para KDevPlatform.
+Comment[it]=Uno scambia documento utilizzato più di recente per KDevPlatform
Comment[nb]=En dokumentbytter for KDevPlatform som behandler sist brukte dokumenter
Comment[nds]=En Togrieper op de tolest bruukten Dokmenten för KDevPlatform
+Comment[nl]=De meest-recent-gebruikte documentwisselaar voor KDevPlatform.
+Comment[pl]=Przełączanie między ostatnio używanymi dokumentacji w KDevPlatform.
Comment[pt]=Um selector dos documentos mais recentes para o KDevPlatform.
Comment[pt_BR]=Um seletor dos documentos mais recentes para o KDevPlatform.
Comment[ru]=Переключение между наиболее часто используемыми документами в приложенияхKDevPlatform.
+Comment[sl]=Vstavek za preklapljanje med nazadnje uporabljenimi dokumenti.
Comment[sv]=Byte till senast använda dokument för KDevelop-plattformen.
Comment[uk]=Перемикач останніх використаних документів для KDevPlatform.
Comment[x-test]=xxA most-recently-used document switcher for KDevPlatform.xx
@@ -26,17 +31,22 @@
Name[bg]=Последният използван превключвател на документи
Name[ca]=Commutador del document usat més recentment
Name[ca@valencia]=Commutador del document usat més recentment
+Name[da]=Dokumentskifter til nyligt anvendte
Name[de]=Zuletzt-Verwendet-Dokumentumschalter
Name[en_GB]=Most-Recently-Used Document Switcher
Name[es]=Cambiador del documento usado más recientemente
Name[et]=Viimati kasutatud dokumentide vahetaja
Name[fr]=Commutateur de documents parmi les plus récemment utilisés
Name[gl]=Selector entre documentos empregados recentemente
+Name[it]=Scambia documento utilizzato più di recente
Name[nb]=Sist-brukte dokumentbytter
Name[nds]=Togrieper för de tolest bruukten Dokmenten
+Name[nl]=Meest-recent-gebruikte documentwisselaar
+Name[pl]=Przełączanie między ostatnio używanymi dokumentami
Name[pt]=Selector dos Documentos Usados Mais Recentemente
Name[pt_BR]=Seletor dos Documentos Usados Mais Recentemente
Name[ru]=Переключатель между наиболее часто используемыми документами
+Name[sl]=Preklapljanje med nazadnje uporabljenimi dokumenti
Name[sv]=Byte till senast använda dokument
Name[uk]=Перемикач нещодавно використаних документів
Name[x-test]=xxMost-Recently-Used Document Switcherxx
@@ -46,18 +56,23 @@
GenericName[bg]=Превключвател на документи
GenericName[ca]=Commutador de documents
GenericName[ca@valencia]=Commutador de documents
+GenericName[cs]=Přepínač dokumentů
+GenericName[da]=Dokumentskifter
GenericName[de]=Dokumentumschalter
GenericName[en_GB]=Document Switcher
GenericName[es]=Cambiador de documento
GenericName[et]=Dokumendivahetaja
GenericName[fr]=Commutateur de documents
GenericName[gl]=Selector entre documentos
+GenericName[it]=Scambia documento
GenericName[nb]=Dokumentbytter
GenericName[nds]=Dokment-Togriep
-GenericName[nl]=Document-omschakelaar
+GenericName[nl]=Documentenwisselaar
+GenericName[pl]=Przełączanie między dokumentami
GenericName[pt]=Selector de Documentos
GenericName[pt_BR]=Seletor de Documentos
GenericName[ru]=Переключатель документов
+GenericName[sl]=Preklapljanje med dokumenti
GenericName[sv]=Dokumentbyte
GenericName[tr]=Belge Seçici
GenericName[uk]=Інструмент перемикання документів
@@ -70,6 +85,6 @@
X-KDE-PluginInfo-Author=Andreas Pakulat
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-License=GPL
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/documentview/kdevdocumentview.cpp kdevplatform-1.0.1/plugins/documentview/kdevdocumentview.cpp
--- kdevplatform-0.9.98/plugins/documentview/kdevdocumentview.cpp 2009-12-05 00:34:34.000000000 +0000
+++ kdevplatform-1.0.1/plugins/documentview/kdevdocumentview.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -63,8 +63,9 @@
setFocusPolicy( Qt::NoFocus );
setRootIsDecorated( false );
- header() ->hide();
- header() ->setResizeMode( QHeaderView::Stretch );
+ header()->hide();
+ header()->setResizeMode(0, QHeaderView::ResizeToContents);
+ header()->setStretchLastSection(false);
setSelectionBehavior( QAbstractItemView::SelectRows );
setSelectionMode( QAbstractItemView::ExtendedSelection );
@@ -188,13 +189,7 @@
QAction* closeUnselected = ctxMenu->addAction(KIcon("document-close"), i18n( "Close Other Files" ), this, SLOT(closeUnselected()));
closeUnselected->setEnabled(!m_unselectedDocs.isEmpty());
- QMenu* vcsmenu = ctxMenu;
- if( vcsActions.count() > 1 )
- {
- vcsmenu = ctxMenu->addMenu( i18n("Version Control "));
- fprintf(stderr, "vcs");
- }
- appendActions(vcsmenu, vcsActions);
+ appendActions(ctxMenu, vcsActions);
appendActions(ctxMenu, extensionActions);
diff -Nru kdevplatform-0.9.98/plugins/documentview/kdevdocumentview.desktop kdevplatform-1.0.1/plugins/documentview/kdevdocumentview.desktop
--- kdevplatform-0.9.98/plugins/documentview/kdevdocumentview.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/documentview/kdevdocumentview.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -5,16 +5,22 @@
Comment=This plugin displays a graphical view of all documents currently loaded and separates them by mimetype.
Comment[ca]= Aquest connector mostra una visualització gràfica de tots els documents carregats actualment, separats per tipus MIME.
Comment[ca@valencia]= Este connector mostra una visualització gràfica de tots els documents carregats actualment, separats per tipus MIME.
+Comment[da]=Dette plugin viser en grafisk oversigt over alle indlæste dokumenter og adskilder dem efter MIME-type.
Comment[de]=Dieses Modul zeigt alle aktuell geladenen Dokumente getrennt nach ihren MIME-Typen an.
Comment[en_GB]=This plugin displays a graphical view of all documents currently loaded and separates them by mimetype.
Comment[es]=Este complemento muestra una vista gráfica de todos los documentos cargados actualmente y los separa por su tipo MIME.
Comment[et]=See plugin näitab graafiliselt kõiki laaditud dokumente ja eraldab need MIME tüübi alusel.
Comment[fr]=Ce module externe affiche une vue graphique de tous les documents actuellement chargés et les sépare par type MIME.
+Comment[ga]=Taispeánann an breiseán seo amharc grafach ar gach cáipéis atá luchtaithe faoi láthair, agus dealaíonn sé iad de réir a gcineál MIME.
Comment[gl]=Esta extensión mostra unha vista gráfica de todos os documentos agora cargados e sepáraos segundo o seu tipo mime.
+Comment[it]=Questa estensione mostra una vista grafica di tutti i documenti attualmente caricati e li separa per il tipo MIME.
Comment[nb]=Dette programtillegget gir en grafisk visning av alle dokumenter som nå er lastet inn og skiller dem etter mimetype.
Comment[nds]=Dit Moduul wiest all opstunns laadt Dokmenten graafsch un sorteert se na MIME-Typ.
+Comment[nl]=Deze plugin toont een grafische voorstelling van alle nu geladen documenten en scheidt deze door het mimetype.
+Comment[pl]=Ta wtyczka udostępnia graficzny widok wszystkich obecnie wczytanych dokumentów i dzieli je według typu MIME.
Comment[pt]=Este 'plugin' mostra uma vista gráfica sobre todos os documentos carregados de momento e separa-os por tipo MIME.
Comment[pt_BR]=Este plugin mostra uma vista gráfica sobre todos os documentos carregados no momento e separa-os por tipo MIME.
+Comment[sl]=Vstavek prikazuje vse trenutno naložene dokumente in jih ločuje glede na zvrst MIME.
Comment[sv]=Insticksprogrammet visar en grafisk vy av alla dokument som för närvarande har laddats och delar upp dem enligt Mime-typ.
Comment[uk]=Цей додаток відображає у графічному вигляді всі відкриті документи і впорядковує їх за типом MIME.
Comment[x-test]=xxThis plugin displays a graphical view of all documents currently loaded and separates them by mimetype.xx
@@ -23,17 +29,22 @@
Name=Document View
Name[ca]=Visor de document
Name[ca@valencia]=Visor de document
+Name[da]=Dokumentvisning
Name[de]=Dokumentansicht
Name[en_GB]=Document View
Name[es]=Vista de documento
Name[et]=Dokumendivaade
Name[fr]=Vue Document
Name[gl]=Vista do documento
+Name[it]=Vista documento
+Name[ja]=文書ビュー
Name[nb]=Dokumentvisning
Name[nds]=Dokmentenansicht
Name[nl]=Document-overzicht
+Name[pl]=Widok dokumentu
Name[pt]=Área de Documentos
Name[pt_BR]=Área de Documentos
+Name[sl]=Prikaz dokumentov
Name[sv]=Dokumentvy
Name[tr]=Belge Görünümü
Name[uk]=Перегляд документів
@@ -43,17 +54,22 @@
GenericName=Document Tool
GenericName[ca]=Eina de document
GenericName[ca@valencia]=Eina de document
+GenericName[da]=Dokumentværktøj
GenericName[de]=Dokument-Werkzeug
GenericName[en_GB]=Document Tool
GenericName[es]=Herramienta de documento
GenericName[et]=Dokumendi tööriist
GenericName[fr]=Outil Document
GenericName[gl]=Utilidade de documento
+GenericName[it]=Strumenti documento
+GenericName[ja]=文書ツール
GenericName[nb]=Dokumentverktøy
GenericName[nds]=Dokmentenwarktüüch
GenericName[nl]=Document-hulpmiddel
+GenericName[pl]=Narzędzie dokumentu
GenericName[pt]=Ferramenta de Documentos
GenericName[pt_BR]=Ferramenta de Documentos
+GenericName[sl]=Orodje za dokumente
GenericName[sv]=Dokumentverktyg
GenericName[tr]=Belge Aracı
GenericName[uk]=Інструмент роботи з документами
@@ -66,6 +82,6 @@
X-KDE-PluginInfo-Author=Adam Treat
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-License=LGPL
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/documentview/settings/kcm_documentview_settings.desktop kdevplatform-1.0.1/plugins/documentview/settings/kcm_documentview_settings.desktop
--- kdevplatform-0.9.98/plugins/documentview/settings/kcm_documentview_settings.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/documentview/settings/kcm_documentview_settings.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -13,17 +13,22 @@
Name=Document View
Name[ca]=Visor de document
Name[ca@valencia]=Visor de document
+Name[da]=Dokumentvisning
Name[de]=Dokumentansicht
Name[en_GB]=Document View
Name[es]=Vista de documento
Name[et]=Dokumendivaade
Name[fr]=Vue Document
Name[gl]=Vista do documento
+Name[it]=Vista documento
+Name[ja]=文書ビュー
Name[nb]=Dokumentvisning
Name[nds]=Dokmentenansicht
Name[nl]=Document-overzicht
+Name[pl]=Widok dokumentu
Name[pt]=Área de Documentos
Name[pt_BR]=Área de Documentos
+Name[sl]=Prikaz dokumentov
Name[sv]=Dokumentvy
Name[tr]=Belge Görünümü
Name[uk]=Перегляд документів
@@ -33,16 +38,23 @@
Comment=Configure Document View settings
Comment[ca]=Configura els arranjaments del visor de document
Comment[ca@valencia]=Configura els arranjaments del visor de document
+Comment[da]=Indtil dokumentvisning
Comment[de]=Dokument-Ansicht einrichten
Comment[en_GB]=Configure Document View settings
Comment[es]=Configurar las preferencias de las vistas de documentos
Comment[et]=Dokumendivaate valikute seadistamine
Comment[fr]=Configurer les paramètres de la vue Document
+Comment[ga]=Cumraigh an tAmharc Cáipéise
Comment[gl]=Configuración da vista do documento
+Comment[it]=Configura le impostazioni di visualizzazione del documento
+Comment[ja]=文書ビューのオプションを設定します
Comment[nb]=Sett opp innstillinger for dokumentvisning
Comment[nds]=Dokmentenansicht instellen
+Comment[nl]=Documentweergave-instellingen configureren
+Comment[pl]=Konfiguruj widok dokumentu
Comment[pt]=Configurar as opções da Área de Documentos
Comment[pt_BR]=Configurar as opções da Área de Documentos
+Comment[sl]=Nastavite prikaz dokumentov
Comment[sv]=Anpassa inställningar av dokumentvy
Comment[tr]=Belge Görünümü Ayarlarını Yapılandır
Comment[uk]=Налаштувати параметри перегляду документа
diff -Nru kdevplatform-0.9.98/plugins/execute/executeplugin.cpp kdevplatform-1.0.1/plugins/execute/executeplugin.cpp
--- kdevplatform-0.9.98/plugins/execute/executeplugin.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/execute/executeplugin.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -184,7 +184,7 @@
executable = item->executable()->builtUrl();
}
}
- if( !executable.isLocalFile() || executable.isEmpty() )
+ if( executable.isEmpty() )
{
err = i18n("No valid executable specified");
kWarning() << "Launch Configuration:" << cfg->name() << "no valid executable set";
diff -Nru kdevplatform-0.9.98/plugins/execute/kdevexecute.desktop kdevplatform-1.0.1/plugins/execute/kdevexecute.desktop
--- kdevplatform-0.9.98/plugins/execute/kdevexecute.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/execute/kdevexecute.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,6 +6,7 @@
Comment[bg]=Тaзи приставка позволява изпълнение на програмата без основния модул, т.е. локално на текущата машина.
Comment[ca]=Aquest connector permet executar programes sense «instrumentor», es a dir, nativament per l'amfitrió actual.
Comment[ca@valencia]=Este connector permet executar programes sense «instrumentor», s'a dir, nativament per l'amfitrió actual.
+Comment[da]=Dette plugin tillader kørsel af programmer uden instrumentor dvs. nativt på det nuværende system.
Comment[de]=Dieses Modul erlaubt das Ausführen von Programmen im Kontext des Betriebssystems.
Comment[el]=Αυτό το πρόσθετο επιτρέπει την εκτέλεση προγραμμάτων χωρίς οργανωτή, πχ. εγγενώς από τον τρέχων υπολογιστή.
Comment[en_GB]=This plugin allows running of programs with no instrumentor, ie. natively by the current host.
@@ -13,8 +14,10 @@
Comment[et]=See plugin võimaldab panna programme aktiivses masinas tööle ilma instrumentaatorita, s.t loomulikult.
Comment[fr]=Ce module externe permet le lancement de programmes sans instrumenteur, c'est-à-dire nativement par l'hôte actuel.
Comment[gl]=Este engadido permite executar programas sen instrumentador, i.e. de xeito nativo na máquina actual.
+Comment[it]=Questa estensione permette l'esecuzione dei programmi senza instrumentor, vale a dire nativamente da parte dell'host attuale.
Comment[nb]=Dette programtillegget tillater kjøring av programmer uten instrumentering, dvs. lokalt på den gjeldende verten.
Comment[nds]=Dit Moduul föhrt Programmen ahn Utstatter ut, d.h. bloots mit den aktuellen Reekner.
+Comment[nl]=Deze plugin staat het uitvoeren van programma's toe zonder hulpprogramma, dwz. van nature op de huidige host.
Comment[pt]=Este 'plugin' permite a execução dos programas não-instrumentalizados, i.e. nativamente pela máquina actual.
Comment[pt_BR]=Esta extensão permite rodar programas sem orquestrador, ou seja, nativamente pelo computador hospedeiro.
Comment[sv]=Insticksprogrammet tillåter att program utan instrumentering körs, dvs. direkt av nuvarande värddator.
@@ -26,6 +29,8 @@
Name[bg]=Изпълняване на програми
Name[ca]=Executa programes
Name[ca@valencia]=Executa programes
+Name[cs]=Spustit programy
+Name[da]=Kør programmer
Name[de]=Programme ausführen
Name[en_GB]=Execute Programs
Name[es]=Ejecutar programas
@@ -33,13 +38,16 @@
Name[fr]=Exécuter des programmes
Name[ga]=Rith Ríomhchláir
Name[gl]=Executar programas
+Name[it]=Esegui i programmi
Name[ja]=プログラムを実行
Name[nb]=Kjør programmer
Name[nds]=Programmen utföhren
Name[nl]=Programma's uitvoeren
+Name[pl]=Uruchamianie programów
Name[pt]=Execução de Programas
Name[pt_BR]=Executar programa
Name[ru]=Выполнение команд оболочки
+Name[sl]=Izvedi programe
Name[sv]=Kör program
Name[tr]=Uygulamaları Çalıştır
Name[uk]=Виконання програм
@@ -50,18 +58,23 @@
GenericName[bg]=Поддръжка за изпълнение на програми
GenericName[ca]=Implementació d'execució de programes
GenericName[ca@valencia]=Implementació d'execució de programes
+GenericName[da]=Understøttelse af kørsel af programmer
GenericName[de]=Unterstützung zur Ausführung von Programmen
GenericName[en_GB]=Program Execution Support
GenericName[es]=Implementación de la ejecución de programas
GenericName[et]=Programmide täitmise toetus
GenericName[fr]=Prise en charge de l'exécution des programmes
GenericName[gl]=Soporte de execución de programas
+GenericName[it]=Supporto esecuzione programmi
GenericName[ja]=プログラム実行のサポート
GenericName[nb]=Støtte for programkjøring
GenericName[nds]=Programmutföhr-Ünnerstütten
+GenericName[nl]=Ondersteuning voor uitvoeren van programma
+GenericName[pl]=Obsługa uruchamiania programów
GenericName[pt]=Suporte à Execução de Programas
GenericName[pt_BR]=Suporte a execução de programa
GenericName[ru]=Поддержка запуска программ
+GenericName[sl]=Podpora za izvajanje programov
GenericName[sv]=Stöd för körning av program
GenericName[tr]=Uygulama Çalıştırma Desteği
GenericName[uk]=Підтримка виконання програм
@@ -70,7 +83,7 @@
GenericName[zh_TW]=執行程式支援
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevexecute
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDE-PluginInfo-Name=kdevexecute
X-KDE-PluginInfo-Author=Hamish Rodda
diff -Nru kdevplatform-0.9.98/plugins/execute/nativeappconfig.cpp kdevplatform-1.0.1/plugins/execute/nativeappconfig.cpp
--- kdevplatform-0.9.98/plugins/execute/nativeappconfig.cpp 2009-11-15 20:28:13.000000000 +0000
+++ kdevplatform-1.0.1/plugins/execute/nativeappconfig.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -76,7 +76,7 @@
//runInTerminal->setChecked( cfg.readEntry( ExecutePlugin::useTerminalEntry, false ) );
QVariantList deps = KDevelop::stringToQVariant( cfg.readEntry( ExecutePlugin::dependencyEntry, QString() ) ).toList();
QStringList strDeps;
- foreach( QVariant dep, deps ) {
+ foreach( const QVariant& dep, deps ) {
QListWidgetItem* item = new QListWidgetItem( KDevelop::joinWithEscaping( dep.toStringList(), '/', '\\' ), dependencies );
item->setData( Qt::UserRole, dep );
}
@@ -364,4 +364,15 @@
cfg.sync();
}
+void NativeAppConfigType::configureLaunchFromCmdLineArguments ( KConfigGroup cfg, const QStringList& args ) const
+{
+ cfg.writeEntry( ExecutePlugin::isExecutableEntry, true );
+ cfg.writeEntry( ExecutePlugin::executableEntry, args.first() );
+ QStringList a(args);
+ a.removeFirst();
+ cfg.writeEntry( ExecutePlugin::argumentsEntry, a);
+ cfg.sync();
+}
+
+
#include "nativeappconfig.moc"
diff -Nru kdevplatform-0.9.98/plugins/execute/nativeappconfig.h kdevplatform-1.0.1/plugins/execute/nativeappconfig.h
--- kdevplatform-0.9.98/plugins/execute/nativeappconfig.h 2009-10-31 19:07:41.000000000 +0000
+++ kdevplatform-1.0.1/plugins/execute/nativeappconfig.h 2010-07-17 19:58:27.000000000 +0100
@@ -85,6 +85,8 @@
bool canLaunch( const KUrl& file ) const;
void configureLaunchFromItem ( KConfigGroup cfg,
KDevelop::ProjectBaseItem* item ) const;
+ void configureLaunchFromCmdLineArguments ( KConfigGroup cfg,
+ const QStringList& args ) const;
private:
QList factoryList;
};
diff -Nru kdevplatform-0.9.98/plugins/execute/nativeappconfig.ui kdevplatform-1.0.1/plugins/execute/nativeappconfig.ui
--- kdevplatform-0.9.98/plugins/execute/nativeappconfig.ui 2009-11-15 20:28:13.000000000 +0000
+++ kdevplatform-1.0.1/plugins/execute/nativeappconfig.ui 2010-07-17 19:58:27.000000000 +0100
@@ -56,7 +56,7 @@
false
- Enter the absolute path to an executable file
+ Enter the executable name or absolute path to an executable file
diff -Nru kdevplatform-0.9.98/plugins/execute/nativeappjob.cpp kdevplatform-1.0.1/plugins/execute/nativeappjob.cpp
--- kdevplatform-0.9.98/plugins/execute/nativeappjob.cpp 2010-01-30 22:21:53.000000000 +0000
+++ kdevplatform-1.0.1/plugins/execute/nativeappjob.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -113,7 +113,7 @@
proc->setProgram( executable.toLocalFile(), arguments );
- setTitle(cfg->name());
+ setObjectName(cfg->name());
}
@@ -167,7 +167,7 @@
{
setError( -1 );
QString errmsg = i18n("Could not start program '%1'. Make sure that the "
- "path is specified correctly.", proc->property("executable").toString() );
+ "path is specified correctly.", proc->program().join(" ") );
KMessageBox::error( KDevelop::ICore::self()->uiController()->activeMainWindow(), errmsg, i18n("Could not start application") );
setErrorText( errmsg );
emitResult();
diff -Nru kdevplatform-0.9.98/plugins/filemanager/filemanager.cpp kdevplatform-1.0.1/plugins/filemanager/filemanager.cpp
--- kdevplatform-0.9.98/plugins/filemanager/filemanager.cpp 2009-08-11 23:38:07.000000000 +0100
+++ kdevplatform-1.0.1/plugins/filemanager/filemanager.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -20,6 +20,7 @@
#include "filemanager.h"
#include
+#include
#include
#include
@@ -32,9 +33,18 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
#include
+#include
+#include
#include
+#include
+#include
#include "kdevfilemanagerplugin.h"
@@ -58,6 +68,7 @@
dirop->setView( KFile::Tree );
dirop->setupMenu( KDirOperator::SortActions | KDirOperator::FileActions | KDirOperator::NavActions | KDirOperator::ViewActions );
connect(dirop, SIGNAL(urlEntered(const KUrl&)), SLOT(updateNav(const KUrl&)));
+ connect(dirop, SIGNAL(contextMenuAboutToShow(KFileItem,QMenu*)), SLOT(fillContextMenu(KFileItem,QMenu*)));
//KDirOperator emits fileSelected() twice because both activated() and doubleClicked() emit fileClicked().
//activated() should be enough, so disconnect doubleClicked()
disconnect(dirop->view(), SIGNAL(doubleClicked(const QModelIndex&)),
@@ -69,6 +80,17 @@
setupActions();
}
+void FileManager::fillContextMenu(KFileItem item, QMenu* menu)
+{
+ menu->addSeparator();
+ menu->addAction(newFileAction);
+ if (item.isFile()) {
+ KDevelop::FileContext context(item.url());
+ QList extensions = KDevelop::ICore::self()->pluginController()->queryPluginsForContextMenuExtensions( &context );
+ KDevelop::ContextMenuExtension::populateMenu(menu, extensions);
+ }
+}
+
void FileManager::openFile(const KFileItem& file)
{
KDevelop::ICore::self()->documentController()->openDocument( file.url() );
@@ -101,6 +123,35 @@
tbActions << (dirop->actionCollection()->action("sorting menu"));
tbActions << (dirop->actionCollection()->action("show hidden"));
+ newFileAction = new KAction(this);
+ newFileAction->setText(i18n("New File..."));
+ newFileAction->setIcon(KIcon("document-new"));
+ connect(newFileAction, SIGNAL(triggered()), this, SLOT(createNewFile()));
+}
+
+void FileManager::createNewFile()
+{
+ KParts::MainWindow *activeMainWindow = KDevelop::ICore::self()->uiController()->activeMainWindow();
+
+ //TODO: adymo: use KNameAndUrlInputDialog here once we depend on KDE 4.5
+ bool ok = false;
+ QString fileName = KInputDialog::getText(i18n("Create New File"),
+ i18n("Filename:"), "", &ok, activeMainWindow);
+ if (!ok) return;
+
+ KTemporaryFile tmpFile;
+ if (!tmpFile.open()) {
+ kError() << "Couldn't create temp file!";
+ return;
+ }
+
+ KUrl destUrl = dirop->url();
+ destUrl.addPath(fileName);
+
+ if (KIO::NetAccess::file_copy(KUrl(tmpFile.fileName()), destUrl))
+ KDevelop::ICore::self()->documentController()->openDocument( destUrl );
+ else
+ KMessageBox::error(activeMainWindow, i18n("Unable to create file '%1'").arg(fileName));
}
void FileManager::syncCurrentDocumentDirectory()
diff -Nru kdevplatform-0.9.98/plugins/filemanager/filemanager.h kdevplatform-1.0.1/plugins/filemanager/filemanager.h
--- kdevplatform-0.9.98/plugins/filemanager/filemanager.h 2008-06-26 19:39:22.000000000 +0100
+++ kdevplatform-1.0.1/plugins/filemanager/filemanager.h 2010-07-17 19:58:27.000000000 +0100
@@ -25,7 +25,9 @@
class KDirOperator;
class KUrlNavigator;
class KFileItem;
+class KAction;
class QString;
+class QMenu;
class KUrl;
class KDevFileManagerPlugin;
@@ -39,9 +41,12 @@
void gotoUrl(const KUrl&);
void updateNav( const KUrl& url );
void syncCurrentDocumentDirectory();
+ void fillContextMenu(KFileItem item, QMenu *menu);
+ void createNewFile();
private:
void setupActions();
QList tbActions;
+ KAction *newFileAction;
KDirOperator* dirop;
KUrlNavigator* urlnav;
diff -Nru kdevplatform-0.9.98/plugins/filemanager/kdevfilemanager.desktop kdevplatform-1.0.1/plugins/filemanager/kdevfilemanager.desktop
--- kdevplatform-0.9.98/plugins/filemanager/kdevfilemanager.desktop 2010-01-19 12:39:48.000000000 +0000
+++ kdevplatform-1.0.1/plugins/filemanager/kdevfilemanager.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,6 +6,7 @@
Comment[bg]=Тaзи приставка вгражда файловия манипулатор към KDevelop.
Comment[ca]=Aquest connector proporciona un gestor de fitxers a KDevelop.
Comment[ca@valencia]=Este connector proporciona un gestor de fitxers a KDevelop.
+Comment[da]=Dette plugin bringer filhåndtering til KDevelop.
Comment[de]=Dieses Modul integriert einen Datei-Browser in KDevelop.
Comment[el]=Αυτό το πρόσθετο ενσωματώνει ένα διαχειριστή αρχείων στο KDevelop
Comment[en_GB]=This plugin brings a filemanager to KDevelop.
@@ -13,13 +14,17 @@
Comment[et]=See plugin võimaldab kasutada KDevelopis failihaldurit.
Comment[fr]=Ce module externe offre un gestionnaire de fichiers pour KDevelop.
Comment[gl]=Este engadido incorpora un xestor de ficheiros no KDevelop.
+Comment[it]=Questa estensione porta un gestore di file in KDevelop.
Comment[ja]=このプラグインはファイルマネージャを KDevelop に統合します
Comment[lv]=Šis spraudnis nodrošina failu pārvaldnieka funkcionalitāti iekš KDevelop.
Comment[nb]=Dette programtillegget tar inn en filbehandler i KDevelop.
Comment[nds]=Dit Moduul stellt en Dateipleger för KDevelop praat.
+Comment[nl]=Deze plugin brengt een bestandsbeheerder in KDevelop.
+Comment[pl]=Ta wtyczka udostępnia menadżer plików w KDevelopie.
Comment[pt]=Este 'plugin' oferece um gestor de ficheiros para o KDevelop.
Comment[pt_BR]=Esta extensão provê um gerenciador de arquivos ao KDevelop
Comment[ru]=Этот модуль добавляет диспетчер файлов в KDevelop
+Comment[sl]=Vstavek v KDevelop prinese upravljalnik datotek.
Comment[sv]=Insticksprogrammet ger KDevelop en filhanterare.
Comment[tr]=Bu eklenti KDevelop için bir dosya yönetici sağlar.
Comment[uk]=За допомогою цього додатка можна отримати доступ до менеджера файлів у KDevelop.
@@ -30,18 +35,23 @@
Name[bg]=Интегриране на файлов манипулатор на KDE
Name[ca]=Integració del gestor de fitxers del KDE
Name[ca@valencia]=Integració del gestor de fitxers del KDE
+Name[da]=Integration af KDE filhåndtering
Name[de]=KDE-Dateimanager-Integration
Name[en_GB]=KDE File Manager Integration
Name[es]=Integración del gestor de archivos de KDE
Name[et]=KDE lõimimine failihalduriga
Name[fr]=Intégration du gestionnaire de fichiers de KDE
Name[gl]=Integración co xestor de ficheiros do KDE
+Name[it]=Integrazione gestore di file di KDE
Name[ja]=KDE のファイルマネージャの統合
Name[nb]=Integrasjon med KDE filbehandler
Name[nds]=KDE-Dateiplegerünnerstütten
+Name[nl]=KDE Bestandsbeheerder-integratie
+Name[pl]=Integracja menadżera plików KDE
Name[pt]=Integração com o Gestor de Ficheiros do KDE
Name[pt_BR]=Integração com o gerenciador de arquivos do KDE
-Name[ru]=Интеграция файлового менеджера KDE
+Name[ru]=Интеграция диспетчера файлов KDE
+Name[sl]=Integracija KDE-jevega upravljalnika datotek
Name[sv]=Integrering med KDE:s filhanterare
Name[tr]=KDE Dosya Yöneticisi Bütünleşmesi
Name[uk]=Інтеграція засобу керування файлами KDE
@@ -52,6 +62,8 @@
GenericName[bg]=Файлов манипулатор
GenericName[ca]=Gestor de fitxers
GenericName[ca@valencia]=Gestor de fitxers
+GenericName[cs]=Správce souborů
+GenericName[da]=Filhåndtering
GenericName[de]=Dateimanager
GenericName[el]=Διαχειριστής αρχείων
GenericName[en_GB]=File Manager
@@ -61,17 +73,21 @@
GenericName[fr]=Gestionnaire de fichiers
GenericName[ga]=Bainisteoir Comhad
GenericName[gl]=Xestor de ficheiros
+GenericName[it]=Gestore di file
GenericName[ja]=ファイルマネージャ
GenericName[lt]=Failų tvarkyklė
GenericName[lv]=Failu pārvaldnieks
GenericName[ms]=Pengurus Fail
GenericName[nb]=Filbehandler
GenericName[nds]=Dateipleger
+GenericName[nl]=Bestandsbeheerder
GenericName[pa]=ਫਾਇਲ ਮੈਨੇਜਰ
+GenericName[pl]=Menadżer plików
GenericName[pt]=Gestor de Ficheiros
GenericName[pt_BR]=Gerenciador de arquivos
GenericName[ro]=Gestionar de fișiere
-GenericName[ru]=Файловый менеджер
+GenericName[ru]=Диспетчер файлов
+GenericName[sl]=Upravljalnik datotek
GenericName[sv]=Filhanterare
GenericName[tr]=Dosya Yönetici
GenericName[uk]=Менеджер файлів
@@ -84,6 +100,6 @@
X-KDE-PluginInfo-Author=Alexander Dymo
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-License=GPL
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/filemanager/kdevfilemanagerplugin.cpp kdevplatform-1.0.1/plugins/filemanager/kdevfilemanagerplugin.cpp
--- kdevplatform-0.9.98/plugins/filemanager/kdevfilemanagerplugin.cpp 2008-10-03 19:16:25.000000000 +0100
+++ kdevplatform-1.0.1/plugins/filemanager/kdevfilemanagerplugin.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -79,7 +79,7 @@
void KDevFileManagerPlugin::init()
{
m_factory = new KDevFileManagerViewFactory(this);
- core()->uiController()->addToolView("Filesystem", m_factory);
+ core()->uiController()->addToolView(i18n("Filesystem"), m_factory);
}
KDevFileManagerPlugin::~KDevFileManagerPlugin()
diff -Nru kdevplatform-0.9.98/plugins/genericprojectmanager/genericmanager.cpp kdevplatform-1.0.1/plugins/genericprojectmanager/genericmanager.cpp
--- kdevplatform-0.9.98/plugins/genericprojectmanager/genericmanager.cpp 2010-02-09 17:06:31.000000000 +0000
+++ kdevplatform-1.0.1/plugins/genericprojectmanager/genericmanager.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
#include
@@ -50,6 +51,8 @@
#include "genericmanagerlistjob.h"
+#define ifDebug(x)
+
K_PLUGIN_FACTORY(GenericSupportFactory, registerPlugin(); )
K_EXPORT_PLUGIN(GenericSupportFactory(KAboutData("kdevgenericmanager","kdevgenericprojectmanager",ki18n("Generic Project Manager"), "0.1", ki18n("A plugin to support basic project management on a filesystem level"), KAboutData::License_GPL)))
@@ -60,17 +63,37 @@
GenericProjectManager::IncludeRules getIncludeRules(KDevelop::IProject* project) {
KConfigGroup filtersConfig = project->projectConfiguration()->group("Filters");
QStringList includes = filtersConfig.readEntry("Includes", QStringList("*"));
- QStringList excludes = filtersConfig.readEntry("Excludes", QStringList("*/.*"));
+ QStringList excludes = filtersConfig.readEntry("Excludes", QStringList() << "*/.*" << "*~");
return qMakePair(includes, excludes);
}
+/**
+ * Returns the parent folder item for a given item or the project root item if there is no parent.
+ */
+KDevelop::ProjectFolderItem* getParentFolder(KDevelop::ProjectBaseItem* item)
+{
+ if ( item->parent() ) {
+ return static_cast(item->parent());
+ } else {
+ return item->project()->projectItem();
+ }
+}
+
GenericProjectManager::GenericProjectManager( QObject *parent, const QVariantList & args )
: KDevelop::IPlugin( GenericSupportFactory::componentData(), parent ), KDevelop::IGenericProjectManager()
{
KDEV_USE_EXTENSION_INTERFACE( KDevelop::IProjectFileManager )
KDEV_USE_EXTENSION_INTERFACE( KDevelop::IGenericProjectManager )
Q_UNUSED( args )
+
+ connect(core()->projectController(), SIGNAL(projectClosing(KDevelop::IProject*)),
+ this, SLOT(projectClosing(KDevelop::IProject*)));
+}
+
+void GenericProjectManager::projectClosing(KDevelop::IProject* project)
+{
+ delete m_watchers.take(project);
}
GenericProjectManager::~GenericProjectManager()
@@ -156,7 +179,7 @@
// build lists of valid files and folders with relative urls to the project folder
KUrl::List files;
KUrl::List folders;
- foreach ( KIO::UDSEntry entry, entries ) {
+ foreach ( const KIO::UDSEntry& entry, entries ) {
KUrl url = baseItem->url();
url.addPath( entry.stringValue( KIO::UDSEntry::UDS_NAME ) );
@@ -182,8 +205,8 @@
}
}
- kDebug() << "valid folders:" << folders;
- kDebug() << "valid files:" << files;
+ ifDebug(kDebug() << "valid folders:" << folders;)
+ ifDebug(kDebug() << "valid files:" << files;)
// remove obsolete rows
for ( int j = 0; j < baseItem->rowCount(); ++j ) {
@@ -193,7 +216,7 @@
int index = folders.indexOf( f->url() );
if ( index == -1 ) {
// folder got removed or is now invalid
- kDebug() << "removing folder:" << f->url();
+ ifDebug(kDebug() << "removing folder:" << f->url();)
baseItem->removeRow( j );
--j;
} else {
@@ -210,8 +233,7 @@
int index = files.indexOf( f->url() );
if ( index == -1 ) {
// file got removed or is now invalid
- kDebug() << "removing file:" << f->url();
- baseItem->project()->removeFromFileSet( KDevelop::IndexedString( f->url() ) );
+ ifDebug(kDebug() << "removing file:" << f->url();)
baseItem->removeRow( j );
--j;
} else {
@@ -224,7 +246,6 @@
// add new rows
foreach ( const KUrl& url, files ) {
new KDevelop::ProjectFileItem( baseItem->project(), url, baseItem );
- baseItem->project()->addToFileSet( KDevelop::IndexedString( url ) );
}
foreach ( const KUrl& url, folders ) {
emit appendSubDir( new KDevelop::ProjectFolderItem( baseItem->project(), url, baseItem ) );
@@ -266,6 +287,7 @@
void GenericProjectManager::created(const QString &path)
{
+ kDebug() << "created:" << path;
QFileInfo info(path);
KUrl url = KUrl(path);
@@ -275,8 +297,9 @@
if ( !isValid(url, info.isDir(), p, getIncludeRules(p)) ) {
continue;
}
- if ( !p->foldersForUrl(url).isEmpty() ) {
+ if ( !p->foldersForUrl(url).isEmpty() || !p->filesForUrl(url).isEmpty() ) {
// exists already in this project, happens e.g. when we restart the dirwatcher
+ // for files it also gets triggered for kate's backup files
continue;
}
foreach ( KDevelop::ProjectFolderItem* parentItem, p->foldersForUrl(parent) ) {
@@ -284,7 +307,6 @@
eventuallyReadFolder(new KDevelop::ProjectFolderItem( p, url, parentItem ));
} else {
new KDevelop::ProjectFileItem( p, url, parentItem );
- p->addToFileSet( KDevelop::IndexedString( url ) );
}
}
}
@@ -296,6 +318,7 @@
// stopDirScan...
return;
}
+ kDebug() << "deleted:" << path;
KUrl url = KUrl(path);
foreach ( KDevelop::IProject* p, m_watchers.keys() ) {
@@ -316,28 +339,30 @@
}
KDevelop::ProjectFolderItem* GenericProjectManager::addFolder( const KUrl& url,
- KDevelop::ProjectFolderItem * folder )
+ KDevelop::ProjectFolderItem * parent )
{
- // dirwatcher cares about local folders, yet remote ones have to be added by hand
- KDevelop::ProjectFolderItem* newFolder = 0;
- if ( !url.isLocalFile() ) {
- kDebug() << "adding remote folder" << url << "to" << folder->url();
- newFolder = new KDevelop::ProjectFolderItem( folder->project(), url, folder );
+ kDebug() << "adding folder" << url << "to" << parent->url();
+ KDevelop::ProjectFolderItem* created = 0;
+ stopWatcher(parent);
+ if ( KDevelop::createFolder(url) ) {
+ created = new KDevelop::ProjectFolderItem( parent->project(), url, parent );
}
- return newFolder;
+ continueWatcher(parent);
+ return created;
}
KDevelop::ProjectFileItem* GenericProjectManager::addFile( const KUrl& url,
- KDevelop::ProjectFolderItem * folder )
+ KDevelop::ProjectFolderItem * parent )
{
- // dirwatcher cares about local files, yet remote ones have to be added by hand
- KDevelop::ProjectFileItem* file = 0;
- if ( !url.isLocalFile() ) {
- kDebug() << "adding remote file" << url << "to" << folder->url();
- file = new KDevelop::ProjectFileItem( folder->project(), url, folder );
+ kDebug() << "adding file" << url << "to" << parent->url();
+ KDevelop::ProjectFileItem* created = 0;
+ stopWatcher(parent);
+ if ( KDevelop::createFile(url) ) {
+ created = new KDevelop::ProjectFileItem( parent->project(), url, parent );
}
- return file;
+ continueWatcher(parent);
+ return created;
}
bool GenericProjectManager::renameFolder( KDevelop::ProjectFolderItem * folder, const KUrl& url )
@@ -356,8 +381,6 @@
kDebug() << "trying to rename a file:" << file->url() << url;
if ( rename(file, file->url(), url) ) {
- file->project()->removeFromFileSet( KDevelop::IndexedString( file->url() ) );
- file->project()->addToFileSet( KDevelop::IndexedString( url ) );
file->setUrl(url);
return true;
} else {
@@ -396,22 +419,28 @@
bool GenericProjectManager::removeFolder( KDevelop::ProjectFolderItem * folder )
{
- // dirwatcher cares about local folders, yet remote ones have to be removed by hand
- if ( !folder->url().isLocalFile() ) {
- kDebug() << "removing folder" << folder->url();
+ kDebug() << "removing folder" << folder->url();
+ KDevelop::ProjectFolderItem* parent = getParentFolder(folder);
+ stopWatcher(parent);
+ const bool success = KDevelop::removeUrl(parent->project(), folder->url(), true);
+ if ( success ) {
folder->parent()->removeRow( folder->row() );
}
- return true;
+ continueWatcher(parent);
+ return success;
}
bool GenericProjectManager::removeFile( KDevelop::ProjectFileItem * file )
{
- // dirwatcher cares about local files, yet remote ones have to be removed by hand
- if ( !file->url().isLocalFile() ) {
- kDebug() << "removing file" << file->url();
+ kDebug() << "removing file" << file->url();
+ KDevelop::ProjectFolderItem* parent = getParentFolder(file);
+ stopWatcher(parent);
+ const bool success = KDevelop::removeUrl(file->project(), file->url(), false);
+ if ( success ) {
file->parent()->removeRow( file->row() );
}
- return true;
+ continueWatcher(parent);
+ return success;
}
void GenericProjectManager::stopWatcher(KDevelop::ProjectFolderItem* folder)
diff -Nru kdevplatform-0.9.98/plugins/genericprojectmanager/genericmanager.h kdevplatform-1.0.1/plugins/genericprojectmanager/genericmanager.h
--- kdevplatform-0.9.98/plugins/genericprojectmanager/genericmanager.h 2010-01-28 17:07:01.000000000 +0000
+++ kdevplatform-1.0.1/plugins/genericprojectmanager/genericmanager.h 2010-07-17 19:58:27.000000000 +0100
@@ -92,6 +92,8 @@
void deleted(const QString &path);
void created(const QString &path);
+ void projectClosing(KDevelop::IProject* project);
+
private:
/// Stops watching the given folder for changes, only useful for local files.
void stopWatcher(KDevelop::ProjectFolderItem* folder);
diff -Nru kdevplatform-0.9.98/plugins/genericprojectmanager/kcm_kdev_genericprojectmanagersettings.desktop kdevplatform-1.0.1/plugins/genericprojectmanager/kcm_kdev_genericprojectmanagersettings.desktop
--- kdevplatform-0.9.98/plugins/genericprojectmanager/kcm_kdev_genericprojectmanagersettings.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/genericprojectmanager/kcm_kdev_genericprojectmanagersettings.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -14,6 +14,8 @@
Name[bg]=Настройки на проекта
Name[ca]=Arranjaments del projecte
Name[ca@valencia]=Arranjaments del projecte
+Name[cs]=Nastavení projektu
+Name[da]=Projektindstillinger
Name[de]=Projekteinstellungen
Name[el]=Ρυθμίσεις έργου
Name[en_GB]=Project Settings
@@ -21,16 +23,20 @@
Name[et]=Projekti seadistused
Name[fr]=Paramètres du projet
Name[gl]=Configuración do proxecto
+Name[it]=Impostazioni progetto
Name[ja]=プロジェクトの設定
Name[lt]=Projekto nustatymai
Name[lv]=Projekta iestatījumi
Name[nb]=Prosjektinnstillinger
Name[nds]=Projektinstellen
+Name[nl]=Projectinstellingen
Name[pa]=ਪਰੋਜੈਕਟ ਸੈਟਿੰਗ
+Name[pl]=Ustawienia projektu
Name[pt]=Configuração do Projecto
Name[pt_BR]=Configurações do projeto
Name[ro]=Configurări proiect
Name[ru]=Параметры проекта
+Name[sl]=Nastavitve projekta
Name[sv]=Projektinställningar
Name[tr]=Proje Ayarları
Name[uk]=Параметри проекту
@@ -41,6 +47,8 @@
Comment[bg]=Конфигуриране на проект
Comment[ca]=Configura el projecte
Comment[ca@valencia]=Configura el projecte
+Comment[cs]=Nastavit projekt
+Comment[da]=Indstil projekt
Comment[de]=Projekt einrichten
Comment[el]=Ρύθμιση έργου
Comment[en_GB]=Configure Project
@@ -48,6 +56,7 @@
Comment[et]=Projekti seadistamine
Comment[fr]=Configurer le projet
Comment[gl]=Configurar o proxecto
+Comment[it]=Configura il progetto
Comment[ja]=プロジェクトを設定します
Comment[lt]=Konfigūruoti projektą
Comment[lv]=Konfigurēt projektu
@@ -55,10 +64,12 @@
Comment[nds]=Projekt instellen
Comment[nl]=Project instellen
Comment[pa]=ਪਰੋਜੈੱਕਟ ਸੰਰਚਨਾ
+Comment[pl]=Konfiguruj projektu
Comment[pt]=Configurar o Projecto
Comment[pt_BR]=Configurar projeto
Comment[ro]=Configurează proiectul
Comment[ru]=Настроить проект
+Comment[sl]=Nastavi projekt
Comment[sv]=Anpassa projekt
Comment[tr]=Projeyi Yapılandır
Comment[uk]=Налаштування проекту
diff -Nru kdevplatform-0.9.98/plugins/genericprojectmanager/kdevgenericmanager.desktop kdevplatform-1.0.1/plugins/genericprojectmanager/kdevgenericmanager.desktop
--- kdevplatform-0.9.98/plugins/genericprojectmanager/kdevgenericmanager.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/genericprojectmanager/kdevgenericmanager.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -4,20 +4,24 @@
Name[bg]=Най-общ манипулатор на проект
Name[ca]=Gestor de projectes genèric
Name[ca@valencia]=Gestor de projectes genèric
+Name[da]=Håndtering af generisk projekt
Name[de]=Allgemeine Projektverwaltung
Name[el]=Γενικευμένος διαχειριστής έργου
Name[en_GB]=Generic Project Manager
-Name[es]=Gestor de proyectos genérico
+Name[es]=Gestor de proyectos genéricos
Name[et]=Üldine projektihaldur
Name[fr]=Gestionnaire de projets générique
Name[gl]=Xestor de proxectos xenérico
+Name[it]=Gestore progetto generico
Name[ja]=一般プロジェクトマネージャ
Name[nb]=Generisk prosjektbehandler
Name[nds]=Allmeen Projektpleger
Name[nl]=Generieke projectenbeheerder
Name[pa]=ਆਮ ਪਰੋਜੈਕਟ ਮੈਨੇਜਰ
+Name[pl]=Menadżer zwykłych projektów
Name[pt]=Gestor de Projectos Genérico
Name[pt_BR]=Gerenciador de projeto genérico
+Name[sl]=Upravljalnik generičnih projektov
Name[sv]=Generell projekthantering
Name[tr]=Genel Proje Yönetici
Name[uk]=Звичайний засіб керування проектом
@@ -28,6 +32,7 @@
Comment[bg]=Рарешаване на KDevelop обобщено манипулиране на проекти
Comment[ca]=Permet a KDevelop gestionar projectes genèrics
Comment[ca@valencia]=Permet a KDevelop gestionar projectes genèrics
+Comment[da]=Lader KDevelop håndtere generiske projekter
Comment[de]=Zum Verwalten allgemeiner Projekte in KDevelop
Comment[el]=Επιτρέπει στο KDevelop τη διαχείριση γενικευμένων έργων
Comment[en_GB]=Allow KDevelop to manage generic projects
@@ -35,24 +40,28 @@
Comment[et]=Võimaldab KDevelopil hallata üldisi projekte
Comment[fr]=Permettre à KDevelop de gérer des projets génériques
Comment[gl]=Permítelle a KDevelop xestionar proxectos xenéricos
+Comment[it]=Permette a KDevelop di gestire i progetti generici
Comment[ja]=KDevelop で一般的なプロジェクトを管理できるようにします
Comment[nb]=La KDevelop behandle generiske prosjekter
Comment[nds]=Lett KDevelop allmeen Projekten plegen
+Comment[nl]=Sta toe dat KDevelop generieke projecten beheert
+Comment[pl]=Zezwól KDevelopowi na zarządzanie zwykłymi projektami
Comment[pt]=Permite ao KDevelop gerir projectos genéricos
Comment[pt_BR]=Permite que o KDevelop gerencie projetos genéricos
Comment[ro]=Permite KDevelop să gestioneze proiecte generice
+Comment[sl]=Omogoča, da KDevelop upravlja generične projekte
Comment[sv]=Tillåter att KDevelop hanterar generella projekt
Comment[tr]=KDevelop uygulamasının genel projeleri yönetmesine izin ver
Comment[uk]=За допомогою цього додатка можна увімкнути керування загальними проектами у KDevelop
Comment[x-test]=xxAllow KDevelop to manage generic projectsxx
Comment[zh_CN]=允许 KDevelop 管理常规工程
Comment[zh_TW]=讓 KDevelop 管理一般的專案
-Icon=gear
+Icon=kdevelop
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevgenericmanager
X-KDE-PluginInfo-Name=KDevGenericManager
X-KDevelop-FileManager=None
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Interfaces=org.kdevelop.IProjectFileManager,org.kdevelop.IGenericProjectManager
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/genericprojectmanager/test/stresstest.php kdevplatform-1.0.1/plugins/genericprojectmanager/test/stresstest.php
--- kdevplatform-0.9.98/plugins/genericprojectmanager/test/stresstest.php 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/plugins/genericprojectmanager/test/stresstest.php 2010-07-17 19:58:27.000000000 +0100
@@ -0,0 +1,114 @@
+ -1 && $i < $_SERVER['argc'] - 1 ? $_SERVER['argv'][$i+1] : '';
+
+if ( empty($dir) ) {
+ usage();
+ exit(1);
+}
+
+chdir($dir) or die("cannot go to folder $dir\n");
+
+/// our data class with parent pointer so we can safely rename folders
+/// and still get proper paths for the children afterwards
+class Entry {
+ public $p = null;
+ public $name;
+ /// @return path (including file- / dirname) to this entry
+ public function getPath() {
+ if (!is_null($this->p)) {
+ return $this->p->getPath() . '/' . $this->name;
+ } else {
+ return $this->name;
+ }
+ }
+}
+
+$dirIt = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator('.', RecursiveDirectoryIterator::CURRENT_AS_SELF),
+ RecursiveIteratorIterator::SELF_FIRST
+);
+
+/// we'll grep random entries out of this array
+$entries = array();
+
+/// tmp pointers to dir entries
+/// [dir => &Entry]
+$tmpAssoc = array();
+
+$i = 0;
+foreach($dirIt as $file) {
+ if ( $file->isDot() ) {
+ continue;
+ }
+ $entries[$i] = new Entry;
+ $entries[$i]->name = $file->getFilename();
+ $path = $file->getPath();
+
+ // skip .kdev4 folder or files
+ if (strpos($path, 'kdev4') != -1) {
+ continue;
+ }
+
+ if ($path != './') {
+ $entries[$i]->p = &$tmpAssoc[$path];
+ }
+ if ($file->isDir()) {
+ $tmpAssoc[$file->getPathname()] = &$entries[$i];
+ }
+ ++$i;
+}
+
+unset($tmpAssoc);
+
+printf("Will move %s files randomly around in %s, do you REALLY want to continue?\n".
+ "Type the following if you want to continue: SPARTAAAA ", count($entries), $dir);
+$ret = fgets(STDIN, 10);
+
+if (trim($ret) != 'SPARTAAAA') {
+ echo "bummer, won't do anything, bye\n";
+ exit(2);
+}
+
+// microseconds to sleep after move
+$sleepTime = 250;
+
+// number of moves until we stop
+$moves = 10000;
+
+$moved = 0;
+for($moved = 0; $moved < $moves; ++$moved) {
+ // get random file to move
+ $index = array_rand($entries, 1);
+ $entry =& $entries[$index];
+ $oldPath = $entry->getPath();
+ $newName = $entry->name;
+ $lastDot = strrpos($newName, '.');
+ if ($lastDot == -1 || $lastDot == 0) {
+ $lastDot = strlen($newName);
+ } else {
+ --$lastDot;
+ }
+ $newName = substr_replace($newName, rand(), rand() % $lastDot, rand() % $lastDot);
+ $entry->name = $newName;
+ $newPath = $entry->getPath();
+ printf("moving $oldPath to $newPath\n");
+ rename($oldPath, $newPath);
+ usleep($sleepTime);
+}
\ No newline at end of file
diff -Nru kdevplatform-0.9.98/plugins/grepview/grepdialog.cpp kdevplatform-1.0.1/plugins/grepview/grepdialog.cpp
--- kdevplatform-0.9.98/plugins/grepview/grepdialog.cpp 2009-06-01 14:41:39.000000000 +0100
+++ kdevplatform-1.0.1/plugins/grepview/grepdialog.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -45,21 +45,21 @@
static int const MAX_LAST_SEARCH_ITEMS_COUNT = 15;
-QStringList template_desc = QStringList()
+const QStringList template_desc = QStringList()
<< "verbatim"
<< "assignment"
<< "->MEMBER("
<< "class::MEMBER("
<< "OBJECT->member(";
-QStringList template_str = QStringList()
+const QStringList template_str = QStringList()
<< "%s"
<< "\\<%s\\>[\\t ]*=[^=]"
<< "\\->[\\t ]*\\<%s\\>[\\t ]*\\("
<< "[a-z0-9_$]+[\\t ]*::[\\t ]*\\<%s\\>[\\t ]*\\("
<< "\\<%s\\>[\\t ]*\\->[\\t ]*[a-z0-9_$]+[\\t ]*\\(";
-QStringList filepatterns = QStringList()
+const QStringList filepatterns = QStringList()
<< "*.h,*.hxx,*.hpp,*.hh,*.h++,*.H,*.tlh,*.cpp,*.cc,*.C,*.c++,*.cxx,*.ocl,*.inl,*.idl,*.c,*.m,*.mm,*.M"
<< "*.cpp,*.cc,*.C,*.c++,*.cxx,*.ocl,*.inl,*.c,*.m,*.mm,*.M"
<< "*.h,*.hxx,*.hpp,*.hh,*.h++,*.H,*.tlh,*.idl"
@@ -77,12 +77,17 @@
<< "*.js,*.css,*.yml,*.rb,*.rhtml,*.html.erb,*.rjs,*.js.rjs,*.rxml,*.xml.builder"
<< "CMakeLists.txt,*.cmake"
<< "*";
-
+
+const QStringList excludepatterns = QStringList()
+ << "/CVS/,/SCCS/,/\\.svn/,/_darcs/,/build/,/\\.git/"
+ << "";
+
}
GrepDialog::GrepDialog( GrepViewPlugin * plugin, QWidget *parent )
: KDialog(parent), Ui::GrepWidget(), m_plugin( plugin )
{
+ setAttribute(Qt::WA_DeleteOnClose);
setButtons( KDialog::Ok | KDialog::Cancel );
setButtonText( KDialog::Ok, i18n("Search") );
@@ -114,8 +119,8 @@
recursiveCheck->setChecked(cg.readEntry("recursive", true));
limitToProjectCheck->setChecked(cg.readEntry("search_project_files", true));
- filesCombo->addItems(filepatterns);
- excludeCombo->addItems(cg.readEntry("exclude_patterns", QStringList() << "/CVS/,/SCCS/,/\\.svn/,/_darcs/,/build/" << "") );
+ filesCombo->addItems(cg.readEntry("file_patterns", filepatterns));
+ excludeCombo->addItems(cg.readEntry("exclude_patterns", excludepatterns) );
suppressErrorsCheck->setChecked(cg.readEntry("no_find_errs", true));
@@ -137,8 +142,10 @@
return list;
}
int skippedItem = -1;
+ if (!combo->currentText().isEmpty()) {
+ list << combo->currentText();
+ }
if (combo->currentIndex() != -1 && !combo->itemText(combo->currentIndex()).isEmpty()) {
- list << combo->itemText(combo->currentIndex());
skippedItem = combo->currentIndex();
}
for (int i = 0; i < std::min(MAX_LAST_SEARCH_ITEMS_COUNT, combo->count()); ++i) {
@@ -160,6 +167,7 @@
cg.writeEntry("case_sens", caseSensitiveCheck->isChecked());
cg.writeEntry("no_find_errs", suppressErrorsCheck->isChecked());
cg.writeEntry("exclude_patterns", qCombo2StringList(excludeCombo));
+ cg.writeEntry("file_patterns", qCombo2StringList(filesCombo));
cg.sync();
}
@@ -276,7 +284,7 @@
m_plugin->rememberSearchDirectory(directory().toLocalFile(KUrl::AddTrailingSlash));
- deleteLater();
+ close();
}
#include "grepdialog.moc"
diff -Nru kdevplatform-0.9.98/plugins/grepview/grepoutputmodel.cpp kdevplatform-1.0.1/plugins/grepview/grepoutputmodel.cpp
--- kdevplatform-0.9.98/plugins/grepview/grepoutputmodel.cpp 2009-08-30 21:22:57.000000000 +0100
+++ kdevplatform-1.0.1/plugins/grepview/grepoutputmodel.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -63,7 +63,7 @@
// Translate if the file has changed since grepping
KTextEditor::Range range2 = range;
- range = m_tracker.translateRange( url, range );
+// range = m_tracker.translateRange( url, range );
kDebug() << "range" << range2 << "translated to " << range;
diff -Nru kdevplatform-0.9.98/plugins/grepview/grepviewplugin.cpp kdevplatform-1.0.1/plugins/grepview/grepviewplugin.cpp
--- kdevplatform-0.9.98/plugins/grepview/grepviewplugin.cpp 2009-06-01 14:27:06.000000000 +0100
+++ kdevplatform-1.0.1/plugins/grepview/grepviewplugin.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
K_PLUGIN_FACTORY(GrepViewFactory, registerPlugin(); )
K_EXPORT_PLUGIN(GrepViewFactory(KAboutData("kdevgrepview","kdevgrepview", ki18n("Find In Files"), "0.1", ki18n("Support for running grep over a list of files"), KAboutData::License_GPL)))
@@ -69,6 +70,22 @@
GrepOutputDelegate::self()->deleteLater();
}
+KDevelop::ContextMenuExtension GrepViewPlugin::contextMenuExtension(KDevelop::Context* context)
+{
+ KDevelop::ContextMenuExtension extension = KDevelop::IPlugin::contextMenuExtension(context);
+
+ if ( context->type() == KDevelop::Context::EditorContext ) {
+ KDevelop::EditorContext *econtext = dynamic_cast(context);
+ if ( econtext->view()->selection() ) {
+ QAction* action = new QAction(KIcon("edit-find"), i18n("&Find in Files"), this);
+ connect(action, SIGNAL(triggered(bool)), this, SLOT(showDialog()));
+ extension.addAction(KDevelop::ContextMenuExtension::ExtensionGroup, action);
+ }
+ }
+
+ return extension;
+}
+
void GrepViewPlugin::showDialog()
{
KDevelop::IDocument* doc = core()->documentController()->activeDocument();
@@ -101,7 +118,9 @@
}
if (len > 0 && pattern[len-1] == '\n')
pattern.truncate(len-1);
- dlg->setPattern( pattern );
+ if (!pattern.isEmpty()) {
+ dlg->setPattern( pattern );
+ }
dlg->enableButtonOk( !pattern.isEmpty() );
diff -Nru kdevplatform-0.9.98/plugins/grepview/grepviewplugin.h kdevplatform-1.0.1/plugins/grepview/grepviewplugin.h
--- kdevplatform-0.9.98/plugins/grepview/grepviewplugin.h 2009-05-06 19:46:13.000000000 +0100
+++ kdevplatform-1.0.1/plugins/grepview/grepviewplugin.h 2010-07-17 19:58:27.000000000 +0100
@@ -13,6 +13,8 @@
#define GREPVIEWPART_H_
#include
+#include
+
#include
class GrepViewPlugin : public KDevelop::IPlugin
@@ -24,6 +26,7 @@
~GrepViewPlugin();
void rememberSearchDirectory(QString const & directory);
+ virtual KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context);
private Q_SLOTS:
void showDialog();
diff -Nru kdevplatform-0.9.98/plugins/grepview/kdevgrepview.desktop kdevplatform-1.0.1/plugins/grepview/kdevgrepview.desktop
--- kdevplatform-0.9.98/plugins/grepview/kdevgrepview.desktop 2010-01-19 12:39:48.000000000 +0000
+++ kdevplatform-1.0.1/plugins/grepview/kdevgrepview.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -4,16 +4,22 @@
Comment=Allows fast searching of multiple files using patterns or regular expressions.
Comment[ca]=Permet la cerca ràpida de múltiples fitxers usant patrons o expressions regulars.
Comment[ca@valencia]=Permet la cerca ràpida de múltiples fitxers usant patrons o expressions regulars.
+Comment[da]=Tillader hurtig søgning af flere filer med brug af mønstre eller regulære udtryk.
Comment[de]=Ermöglicht es, dateiübergreifend nach Mustern und regulären Ausdrücken zu suchen.
Comment[en_GB]=Allows fast searching of multiple files using patterns or regular expressions.
Comment[es]=Permitir búsquedas rápidas de múltiples archivos usando patrones o expresiones regulares.
Comment[et]=Lubab mustreid või regulaaravaldisi kasutades kiiresti paljudes failides teksti otsida.
Comment[fr]=Permet la recherche rapide de fichiers multiples à l'aide de motifs ou d'expressions rationnelles.
+Comment[ga]=Ceadaíonn sé duit il-comhaid a chuardach go tapa le patrúin nó sloinn ionadaíochta.
Comment[gl]=Permite facer unha procura rápida en varios ficheiros empregando padróns ou expresións regulares.
+Comment[it]=Consente la ricerca veloce di file multipli usando espressioni regolari o modelli.
Comment[nb]=Gjør raskt søk i flere filer mulig ved hjelp av mønstre eller regulære uttrykk.
Comment[nds]=Stellt gau Dörsöken vun mehr Dateien mit Söökmustern oder reguleer Utdrück praat.
+Comment[nl]=Staat toe snel te zoeken naar meerdere bestanden met gebruik van patronen of reguliere expressies.
+Comment[pl]=Pozwala na szybkie przeszukiwanie plików za pomocą wzorców lub wyrażeń regularnych.
Comment[pt]=Permite pesquisar rapidamente em vários ficheiros, usando padrões ou expressões regulares.
Comment[pt_BR]=Permite pesquisar rapidamente em vários arquivos, usando padrões ou expressões regulares.
+Comment[sl]=Omogoča iskanje po več datotekah, z uporabo vzorcev ali pa regularnih izrazov.
Comment[sv]=Tillåter snabb sökning i flera filer med mönster eller reguljära uttryck.
Comment[uk]=Надає можливості швидкого пошуку декількох файлів на основі шаблонів або формальних виразів.
Comment[x-test]=xxAllows fast searching of multiple files using patterns or regular expressions.xx
@@ -22,16 +28,24 @@
Name=Find In Files
Name[ca]=Cerca en fitxers
Name[ca@valencia]=Cerca en fitxers
+Name[cs]=Najít v souborech
+Name[da]=Find i filer
Name[de]=In Dateien Suchen
Name[en_GB]=Find In Files
Name[es]=Buscar en archivos
Name[et]=Failides otsimine
Name[fr]=Chercher dans les fichiers
Name[gl]=Procurar nos ficheiros
+Name[it]=Trova nei file
+Name[ja]=ファイルを検索
Name[nb]=Finn i filer
Name[nds]=Binnen Dateien söken
+Name[nl]=Zoeken in bestanden
+Name[pl]=Znajdź w plikach
Name[pt]=Procurar nos Ficheiros
Name[pt_BR]=Procurar nos Arquivos
+Name[ru]=Поиск в файлах
+Name[sl]=Najdi v datotekah
Name[sv]=Sök i filer
Name[tr]=Dosyalarda Ara
Name[uk]=Пошук у файлах
@@ -41,16 +55,23 @@
GenericName=Search Tool
GenericName[ca]=Eina de cerca
GenericName[ca@valencia]=Eina de cerca
+GenericName[da]=Søgeværktøj
GenericName[de]=Such-Werkzeug
GenericName[en_GB]=Search Tool
GenericName[es]=Herramienta de búsqueda
GenericName[et]=Otsimise tööriist
GenericName[fr]=Outil de recherche
GenericName[gl]=Utilidade de procura
+GenericName[it]=Strumento ricerca
+GenericName[ja]=検索ツール
GenericName[nb]=Søkeverktøy
GenericName[nds]=Söökwarktüüch
+GenericName[nl]=Hulpmiddel voor zoeken
+GenericName[pl]=Narzędzie wyszukiwania
GenericName[pt]=Ferramenta de Pesquisa
GenericName[pt_BR]=Ferramenta de Pesquisa
+GenericName[ru]=Инструмент поиска
+GenericName[sl]=Orodje za iskanje
GenericName[sv]=Sökverktyg
GenericName[tr]=Arama Aracı
GenericName[uk]=Інструмент пошуку
@@ -61,7 +82,7 @@
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevgrepview
X-KDE-PluginInfo-Name=kdevgrepview
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-IRequired=org.kdevelop.IOutputView
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/konsole/kdevkonsoleview.desktop kdevplatform-1.0.1/plugins/konsole/kdevkonsoleview.desktop
--- kdevplatform-0.9.98/plugins/konsole/kdevkonsoleview.desktop 2010-01-19 12:39:48.000000000 +0000
+++ kdevplatform-1.0.1/plugins/konsole/kdevkonsoleview.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -5,6 +5,7 @@
Comment[bg]=Тaзи приставка осигурява на KDevelop вградена конзола за лесен достъп от команден ред.
Comment[ca]=Aquest connector proporciona a KDevelop un Konsole incrustat per accedir de manera ràpida i fàcil a la línia d'ordres.
Comment[ca@valencia]=Este connector proporciona a KDevelop un Konsole incrustat per accedir de manera ràpida i fàcil a la línia d'ordes.
+Comment[da]=Dette plugin giver KDevelop en indlejret konsol for hurtig og nem kommandolinje adgang.
Comment[de]=Dieses Modul stattet KDevelop mit einer eingebetteten Konsole zum einfachen Zugriff auf die Befehlszeile aus.
Comment[el]=Αυτό το πρόσθετο προσφέρει στο KDevelop μια ενσωματωμένη konsole για γρήγορη και εύκολη πρόσβαση σε γραμμή εντολών.
Comment[en_GB]=This plugin provides KDevelop with an embedded konsole for quick and easy command line access.
@@ -12,12 +13,16 @@
Comment[et]=See plugin pakub KDevelopile põimitud konsooli käsurea kiireks ja lihtsaks kasutamiseks.
Comment[fr]=Ce module externe fournit à KDevelop une console intégrée permettant un accès rapide et aisé à la ligne de commande.
Comment[gl]=Este engadido fornécelle a KDevelop un konsole integrado para dispor de acceso rápido e sinxelo á liña de ordes.
+Comment[it]=Questa estensione dota KDevelop di una console integrata per una rapido e facile accesso alla riga di comando.
Comment[ja]=コマンドラインに簡単に素早くアクセスできるように KDevelop に組み込み Konsole を提供します
Comment[nb]=Dette programtillegget gir KDevelop en innebygget konsole for rask og lett tilgang til kommandolinja.
Comment[nds]=Dit Moduul stellt en inbett Konsole för KDevelop praat, wat gau un eenfach Togriep op de Konsool verlöövt.
+Comment[nl]=Deze plugin biedt KDevelop een ingebed konsole voor snel en gemakkelijk toegang tot commandoregels.
+Comment[pl]=Ta wtyczka dodaje do KDevelopa wbudowaną konsolę umożliwiając szybki i łatwy dostęp do linii komend.
Comment[pt]=Este 'plugin' oferece ao KDevelop uma consola incorporada para um acesso rápido e simples à linha de comandos.
Comment[pt_BR]=Esta extensão provê ao KDevelop um terminal embutido para acesso rápido e fácil a linha de comando.
Comment[ru]=Этот модуль добавляет в KDevelop встроенный терминал для быстрого и лёгкого доступа к командной строке
+Comment[sl]=Vstavek v KDevelop prinaša vgrajeno konzolo za hiter in preprost dostop do ukazne vrstice.
Comment[sv]=Insticksprogrammet ger KDevelop en inbyggd terminal för snabb och enkel åtkomst av kommandoraden.
Comment[uk]=За допомогою цього додатка у KDevelop можна буде скористатися вбудованою konsole, яка пришвидшить і полегшить доступ до командного рядка.
Comment[x-test]=xxThis plugin provides KDevelop with an embedded konsole for quick and easy command line access.xx
@@ -27,17 +32,23 @@
Name[bg]=Интегриране на конзола
Name[ca]=Integració del Konsole
Name[ca@valencia]=Integració del Konsole
+Name[da]=Integration af Konsole
Name[de]=Konsole-Integration
Name[en_GB]=Konsole Integration
Name[es]=Integración de la consola
Name[et]=Lõimimine Konsooliga
Name[fr]=Intégration de Konsole
Name[gl]=Integración con Konsole
+Name[it]=Integrazione Konsole
+Name[ja]=Konsole の統合
Name[nb]=Konsole-integrering
Name[nds]=Konsool-Inbinnen
+Name[nl]=Console-integratie
+Name[pl]=Integracja Konsoli
Name[pt]=Integração com o Konsole
Name[pt_BR]=Integração com o Konsole
Name[ru]=Интеграция Konsole
+Name[sl]=Integracije konzole
Name[sv]=Integrering av Konsole
Name[tr]=Konsole Bütünleşmesi
Name[uk]=Інтеграція Konsole
@@ -48,17 +59,23 @@
GenericName[bg]=Интегриране на терминал
GenericName[ca]=Integració del terminal
GenericName[ca@valencia]=Integració del terminal
+GenericName[da]=Integration af terminal
GenericName[de]=Terminal-Integration
GenericName[en_GB]=Terminal Integration
GenericName[es]=Integración de la terminal
GenericName[et]=Lõimimine terminaliga
GenericName[fr]=Intégration du terminal
GenericName[gl]=Integración co terminal
+GenericName[it]=Integrazione terminale
+GenericName[ja]=ターミナルの統合
GenericName[nb]=Terminalintegrering
GenericName[nds]=Konsool-Inbinnen
+GenericName[nl]=Terminal-integratie
+GenericName[pl]=Integracja terminala
GenericName[pt]=Integração com o Terminal
GenericName[pt_BR]=Integração com o terminal
GenericName[ru]=Интеграция терминала
+GenericName[sl]=Integracija terminala
GenericName[sv]=Integrering av terminal
GenericName[tr]=Uçbirim Bütünleşmesi
GenericName[uk]=Інтеграція термінала
@@ -69,6 +86,6 @@
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevkonsoleview
X-KDE-PluginInfo-Name=kdevkonsoleview
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-Mode=GUI
diff -Nru kdevplatform-0.9.98/plugins/openwith/kdevopenwith.desktop kdevplatform-1.0.1/plugins/openwith/kdevopenwith.desktop
--- kdevplatform-0.9.98/plugins/openwith/kdevopenwith.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/openwith/kdevopenwith.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,16 +6,21 @@
Comment[bg]=Тази приставка позволява отваряне на файлове със съответни външни програми.
Comment[ca]=Aquest connector permet obrir fitxers amb aplicacions externes associades.
Comment[ca@valencia]=Este connector permet obrir fitxers amb aplicacions externes associades.
+Comment[da]=Dette plugin tillader at åbne filer med associerede eksterne applikationer.
Comment[de]=Mit diesem Modul können Dateien mit ihnen zugewiesenen externen Anwendungen gestartet werden.
Comment[en_GB]=This plugin allows to open files with associated external applications.
Comment[es]=Este complemento permite abrir archivos con aplicaciones externas asociadas.
Comment[et]=See plugin võimaldab avada väliste rakendustega seostatud faile.
Comment[fr]=Ce module externe permet d'ouvrir des fichiers avec des applications externes associées.
Comment[gl]=Este engadido permite abrir ficheiros cos programas externos asociados.
+Comment[it]=Questa estensione permette di aprire i file con le relative applicazioni esterne.
Comment[nb]=Dette programtillegget kan åpne filer med tilknyttede eksterne programmer.
Comment[nds]=Mit dit Moduul laat sik Dateien mit towiest extern Programmen opmaken.
+Comment[nl]=Deze plugin biedt het openen van bestanden met geassocieerde externe applicaties.
+Comment[pl]=Ta wtyczka pozwala na otwieranie plików, z którymi są powiązane zewnętrzne programy.
Comment[pt]=Este 'plugin' permite abrir os ficheiros com as aplicações externas associadas.
Comment[pt_BR]=Este plugin permite abrir os arquivos com as aplicações externas associadas.
+Comment[sl]=Vstavek omogoča odpiranje datotek v povezanih zunanjih programih.
Comment[sv]=Insticksprogrammet tillåter att öppna filer med tillhörande externa program.
Comment[uk]=За допомогою цього додатка ви зможете відкривати файли у пов’язаній з ними зовнішній програмі.
Comment[x-test]=xxThis plugin allows to open files with associated external applications.xx
@@ -25,17 +30,23 @@
Name[bg]=Отваряне с
Name[ca]=Obre amb
Name[ca@valencia]=Obri amb
+Name[cs]=Otevřít pomocí
+Name[da]=Åbn med
Name[de]=Öffnen mit
Name[en_GB]=Open With
Name[es]=Abrir con
Name[et]=Avamine rakendusega
Name[fr]=Ouvrir avec
Name[gl]=Abrir con
+Name[it]=Apri con
+Name[ja]=アプリケーションで開く
Name[nb]=Åpne med
Name[nds]=Opmaken mit
Name[nl]=Openen met
+Name[pl]=Otwórz za pomocą
Name[pt]=Abrir Com
Name[pt_BR]=Abrir com
+Name[sl]=Odpri v
Name[sv]=Öppna med
Name[tr]=Birlikte Aç
Name[uk]=Відкриття у зовнішніх програмах
@@ -46,17 +57,23 @@
GenericName[bg]=Отваряне с
GenericName[ca]=Obre amb
GenericName[ca@valencia]=Obri amb
+GenericName[cs]=Otevřít pomocí
+GenericName[da]=Åbn med
GenericName[de]=Öffnen mit
GenericName[en_GB]=Open With
GenericName[es]=Abrir con
GenericName[et]=Avamine rakendusega
GenericName[fr]=Ouvrir avec
GenericName[gl]=Abrir con
+GenericName[it]=Apri con
+GenericName[ja]=アプリケーションで開く
GenericName[nb]=Åpne med
GenericName[nds]=Opmaken mit
GenericName[nl]=Openen met
+GenericName[pl]=Otwórz za pomocą
GenericName[pt]=Abrir Com
GenericName[pt_BR]=Abrir com
+GenericName[sl]=Odpri v
GenericName[sv]=Öppna med
GenericName[tr]=Birlikte Aç
GenericName[uk]=Відкриття у зовнішніх програмах
@@ -65,7 +82,7 @@
GenericName[zh_TW]=開啟方式
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevopenwith
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDE-PluginInfo-Name=kdevopenwith
X-KDE-PluginInfo-Author=Andreas Pakulat
diff -Nru kdevplatform-0.9.98/plugins/patchreview/CMakeLists.txt kdevplatform-1.0.1/plugins/patchreview/CMakeLists.txt
--- kdevplatform-0.9.98/plugins/patchreview/CMakeLists.txt 2009-09-05 03:12:04.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/CMakeLists.txt 2010-07-17 19:58:27.000000000 +0100
@@ -3,11 +3,14 @@
########### next target ###############
add_definitions( ${KDE4_ENABLE_EXCEPTIONS})
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/settings)
set(patchreview_PART_SRCS
patchreview.cpp
documenthighlighter.cpp
localpatchsource.cpp
+ settings/diffsettings.cpp
+ settings/settingsbase.cpp
libdiff2/kompareprocess.cpp
libdiff2/komparemodellist.cpp
@@ -21,8 +24,6 @@
libdiff2/cvsdiffparser.cpp
libdiff2/diffparser.cpp
libdiff2/perforceparser.cpp
- libdiff2/diffsettings.cpp
- libdiff2/settingsbase.cpp
)
set (patchreview_UI
diff -Nru kdevplatform-0.9.98/plugins/patchreview/kdevpatchreview.desktop kdevplatform-1.0.1/plugins/patchreview/kdevpatchreview.desktop
--- kdevplatform-0.9.98/plugins/patchreview/kdevpatchreview.desktop 2010-01-22 10:57:28.000000000 +0000
+++ kdevplatform-1.0.1/plugins/patchreview/kdevpatchreview.desktop 2010-07-17 19:58:27.000000000 +0100
@@ -6,17 +6,21 @@
Comment[bg]=Тази приставка позволява преглеждане на кръпки направо в редактора.
Comment[ca]=Aquest connector permet revisar pedaços directament en l'editor.
Comment[ca@valencia]=Este connector permet revisar pedaços directament en l'editor.
+Comment[da]=Dette plugin tillader at gennemgå rettelser direkte i editoren.
Comment[de]=Dieses Modul ermöglich es, Patches direkt im Editor zu betrachten.
Comment[en_GB]=This plugin allows reviewing patches directly in the editor.
Comment[es]=Este complemento permite revisar parches directamente en el editor.
Comment[et]=See plugin võimaldab paiku üle vaadata otse redaktoris.
Comment[fr]=Ce module externe permet de réviser des correctifs directement dans l'éditeur.
Comment[gl]=Este engadido permite revisar parches directamente no editor.
+Comment[it]=Questa estensione permette di rivedere le patch direttamente nell'editor.
Comment[nb]=Dette programtillegget kan gjennomgå programlapper direkte i redigeringen.
Comment[nds]=Mit dit Moduul laat sik Kodeplasters direktemang binnen den Editor nakieken.
Comment[nl]=Deze plugin laat patches herzien direct in de editor.
+Comment[pl]=Ta wtyczka pozwala na przeglądanie poprawek bezpośrednio w edytorze.
Comment[pt]=Este 'plugin' permite obter as modificações directamente no editor.
Comment[pt_BR]=Este plugin permite obter as modificações diretamente no editor.
+Comment[sl]=Vstavek omogoča pregledovanje popravkov neposredno iz urejevalnika.
Comment[sv]=Insticksprogrammet gör det möjligt att direkt granska programfixar i editorn.
Comment[uk]=За допомогою цього додатка ви зможете рецензувати латки безпосередньо у редакторі.
Comment[x-test]=xxThis plugin allows reviewing patches directly in the editor.xx
@@ -26,17 +30,21 @@
Name[bg]=Преглед на кръпки
Name[ca]=Revisa pedaç
Name[ca@valencia]=Revisa pedaç
+Name[da]=Gennemgang af rettelser
Name[de]=Patch-Durchsicht
Name[en_GB]=Patch Review
Name[es]=Revisión de parches
Name[et]=Paikade ülevaatamine
Name[fr]=Révision de correctifs
Name[gl]=Revisor de parches
+Name[it]=Revisione patch
Name[nb]=Lappegjennomgang
Name[nds]=Plasternakiek
Name[nl]=Patchoverzicht
+Name[pl]=Przeglądanie poprawek
Name[pt]=Revisão da Modificação
Name[pt_BR]=Revisão da Modificação
+Name[sl]=Pregledovanje popravkov
Name[sv]=Granska programfixar
Name[tr]=Yama Gözden Geçirmesi
Name[uk]=Рецензування латки
@@ -47,17 +55,21 @@
GenericName[bg]=Преглед на кръпки
GenericName[ca]=Revisa pedaç
GenericName[ca@valencia]=Revisa pedaç
+GenericName[da]=Gennemgang af rettelser
GenericName[de]=Patch-Durchsicht
GenericName[en_GB]=Patch Review
GenericName[es]=Revisión de parches
GenericName[et]=Paikade ülevaatamine
GenericName[fr]=Révision de correctifs
GenericName[gl]=Revisor de parches
+GenericName[it]=Revisione patch
GenericName[nb]=Lappegjennomgang
GenericName[nds]=Plasternakiek
GenericName[nl]=Patchoverzicht
+GenericName[pl]=Przeglądanie poprawek
GenericName[pt]=Revisão da Modificação
GenericName[pt_BR]=Revisão da Modificação
+GenericName[sl]=Pregledovanje popravkov
GenericName[sv]=Granska programfixar
GenericName[tr]=Yama Gözden Geçirmesi
GenericName[uk]=Рецензування латки
@@ -66,7 +78,7 @@
GenericName[zh_TW]=修補檢視
ServiceTypes=KDevelop/Plugin
X-KDE-Library=kdevpatchreview
-X-KDevelop-Version=8
+X-KDevelop-Version=9
X-KDevelop-Category=Global
X-KDevelop-Interfaces=org.kdevelop.IPatchReview
X-KDE-PluginInfo-Name=kdevpatchreview
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/cvsdiffparser.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/cvsdiffparser.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/cvsdiffparser.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/cvsdiffparser.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -2,8 +2,7 @@
** cvsdiffparser.cpp
** -----------------
** begin : Sun Aug 4 15:05:35 2002
-** copyright : (C) 2002-2004 Otto Bruggeman
-**
+** Copyright 2002-2004 Otto Bruggeman
***************************************************************************/
/***************************************************************************
**
@@ -13,15 +12,15 @@
** ( at your option ) any later version.
**
***************************************************************************/
+
#include "cvsdiffparser.h"
-#include
-#include
+#include
+#include
#include "komparemodellist.h"
-
using namespace Diff2;
CVSDiffParser::CVSDiffParser( const KompareModelList* list, const QStringList& diff ) : ParserBase( list, diff )
@@ -52,27 +51,27 @@
while( it != m_diffLines.end() )
{
- if( (*it).indexOf( normalRE, 0 ) == 0 )
+ if( it->indexOf( normalRE, 0 ) == 0 )
{
// kDebug(8101) << "Difflines are from a Normal diff...";
return Kompare::Normal;
}
- else if( (*it).indexOf( unifiedRE, 0 ) == 0 )
+ else if( it->indexOf( unifiedRE, 0 ) == 0 )
{
// kDebug(8101) << "Difflines are from a Unified diff...";
return Kompare::Unified;
}
- else if( (*it).indexOf( contextRE, 0 ) == 0 )
+ else if( it->indexOf( contextRE, 0 ) == 0 )
{
// kDebug(8101) << "Difflines are from a Context diff...";
return Kompare::Context;
}
- else if( (*it).indexOf( rcsRE, 0 ) == 0 )
+ else if( it->indexOf( rcsRE, 0 ) == 0 )
{
// kDebug(8101) << "Difflines are from a RCS diff...";
return Kompare::RCS;
}
- else if( (*it).indexOf( edRE, 0 ) == 0 )
+ else if( it->indexOf( edRE, 0 ) == 0 )
{
// kDebug(8101) << "Difflines are from an ED diff...";
return Kompare::Ed;
@@ -94,11 +93,10 @@
{
if ( m_normalDiffHeader.exactMatch( *m_diffIterator ) )
{
- kDebug(8101) << "Matched length Header =" << m_normalDiffHeader.matchedLength();
- kDebug(8101) << "Matched string Header =" << m_normalDiffHeader.cap( 0 );
+ kDebug(8101) << "Matched length Header = " << m_normalDiffHeader.matchedLength();
+ kDebug(8101) << "Matched string Header = " << m_normalDiffHeader.cap( 0 );
m_currentModel = new DiffModel();
- QObject::connect( m_currentModel, SIGNAL( setModified( bool ) ), m_list, SLOT( slotSetModified( bool ) ) );
m_currentModel->setSourceFile ( m_normalDiffHeader.cap( 1 ) );
m_currentModel->setDestinationFile ( m_normalDiffHeader.cap( 1 ) );
@@ -109,7 +107,7 @@
}
else
{
- kDebug(8101) << "No match for:" << ( *m_diffIterator );
+ kDebug(8101) << "No match for: " << ( *m_diffIterator );
}
++m_diffIterator;
}
@@ -119,7 +117,6 @@
// Set this to the first line again and hope it is a single file diff
m_diffIterator = m_diffLines.begin();
m_currentModel = new DiffModel();
- QObject::connect( m_currentModel, SIGNAL( setModified( bool ) ), m_list, SLOT( slotSetModified( bool ) ) );
m_singleFileDiff = true;
}
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/cvsdiffparser.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/cvsdiffparser.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/cvsdiffparser.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/cvsdiffparser.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,8 @@
/**************************************************************************
** cvsdiffparser.h
-** -----------------
+** ----------------
** begin : Sun Aug 4 15:05:35 2002
- copyright : (C) 2001-2003 Otto Bruggeman
-**
+** Copyright 2002-2004 Otto Bruggeman
***************************************************************************/
/***************************************************************************
**
@@ -14,10 +13,10 @@
**
***************************************************************************/
-#ifndef _CVSDIFF_PARSER_H
-#define _CVSDIFF_PARSER_H
+#ifndef CVSDIFF_PARSER_H
+#define CVSDIFF_PARSER_H
-#include
+#include
#include "parserbase.h"
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diff2export.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/diff2export.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diff2export.h 1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diff2export.h 2010-07-17 19:58:27.000000000 +0100
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * Copyright 2007 Andreas Pakulat *
+ * Copyright 2006 Matt Rogers *
+ * Copyright 2004 Jarosław Staniek *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef LIBDIFF2EXPORT_H
+#define LIBDIFF2EXPORT_H
+
+# define DIFF2_EXPORT
+
+#endif
+
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/difference.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/difference.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/difference.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/difference.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,9 @@
/***************************************************************************
- difference.cpp - description
- -------------------
+ difference.cpp
+ --------------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2004,2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -25,21 +25,23 @@
m_sourceLineNo( sourceLineNo ),
m_destinationLineNo( destinationLineNo ),
m_applied( false ),
- m_table( new LevenshteinTable() )
+ m_conflicts( false ),
+ m_unsaved( false )
{
}
Difference::~Difference()
{
- delete m_table;
+ qDeleteAll( m_sourceLines );
+ qDeleteAll( m_destinationLines );
}
-void Difference::addSourceLine( const QString& line )
+void Difference::addSourceLine( QString line )
{
m_sourceLines.append( new DifferenceString( line ) );
}
-void Difference::addDestinationLine( const QString& line )
+void Difference::addDestinationLine( QString line )
{
m_destinationLines.append( new DifferenceString( line ) );
}
@@ -57,6 +59,7 @@
void Difference::apply( bool apply )
{
m_applied = apply;
+ m_unsaved = !m_unsaved;
}
void Difference::determineInlineDifferences()
@@ -67,26 +70,22 @@
// Do nothing for now when the slc != dlc
// One could try to find the closest matching destination string for any
// of the source strings but this is compute intensive
- if ( sourceLineCount() != destinationLineCount() )
+ int slc = sourceLineCount();
+
+ if ( slc != destinationLineCount() )
return;
- int slc = sourceLineCount();
-kDebug() << "determining differences";
+ LevenshteinTable table;
+
for ( int i = 0; i < slc; ++i )
{
DifferenceString* sl = sourceLineAt( i );
DifferenceString* dl = destinationLineAt( i );
- // FIXME: If the table cant be created do not do the rest
- m_table->createTable( sl, dl );
-
- m_table->createListsOfMarkers();
+ // return value 0 means something went wrong creating the table so dont bother finding markers
+ if ( table.createTable( sl, dl ) != 0 )
+ table.createListsOfMarkers();
}
-
- // No longer needed, if we ever need to recalculate the inline differences we should
- // simply recreate the table
- delete m_table;
- m_table = 0;
}
QString Difference::recreateDifference() const
@@ -139,3 +138,4 @@
return difference;
}
+
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/difference.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/difference.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/difference.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/difference.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,9 @@
/***************************************************************************
- difference.h - description
- -------------------
+ difference.h
+ ------------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2004,2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -18,21 +18,18 @@
#ifndef DIFFERENCE_H
#define DIFFERENCE_H
-#include
-#include
+#include
#include
-
-#include "diffexport.h"
+#include "diff2export.h"
class QString;
namespace Diff2
{
-class LevenshteinTable;
-class Marker
+class DIFF2_EXPORT Marker
{
public:
enum Type { Start = 0, End = 1 };
@@ -62,22 +59,22 @@
unsigned int m_offset;
};
-typedef Q3ValueList MarkerList;
-typedef Q3ValueList::iterator MarkerListIterator;
-typedef Q3ValueList::const_iterator MarkerListConstIterator;
+typedef QList MarkerList;
+typedef QList::iterator MarkerListIterator;
+typedef QList::const_iterator MarkerListConstIterator;
-class DifferenceString
+class DIFF2_EXPORT DifferenceString
{
public:
DifferenceString()
{
-// kDebug(8101) << "DifferenceString::DifferenceString()";
+// kDebug(8101) << "DifferenceString::DifferenceString()" << endl;
}
explicit DifferenceString( const QString& string, const MarkerList& markerList = MarkerList() ) :
m_string( string ),
m_markerList( markerList )
{
-// kDebug(8101) << "DifferenceString::DifferenceString( " << string << ", " << markerList << " )";
+// kDebug(8101) << "DifferenceString::DifferenceString( " << string << ", " << markerList << " )" << endl;
calculateHash();
}
DifferenceString( const DifferenceString& ds ) :
@@ -86,9 +83,12 @@
m_hash( ds.m_hash ),
m_markerList( ds.m_markerList )
{
-// kDebug(8101) << "DifferenceString::DifferenceString( const DifferenceString& " << ds << " )";
+// kDebug(8101) << "DifferenceString::DifferenceString( const DifferenceString& " << ds << " )" << endl;
+ }
+ ~DifferenceString()
+ {
+ qDeleteAll( m_markerList );
}
- ~DifferenceString() {}
public:
const QString& string() const
@@ -148,11 +148,11 @@
MarkerList m_markerList;
};
-typedef Q3ValueVector DifferenceStringList;
-typedef Q3ValueVector::iterator DifferenceStringListIterator;
-typedef Q3ValueVector::const_iterator DifferenceStringListConstIterator;
+typedef QVector DifferenceStringList;
+typedef QVector::iterator DifferenceStringListIterator;
+typedef QVector::const_iterator DifferenceStringListConstIterator;
-class Difference
+class DIFF2_EXPORT Difference
{
public:
enum Type { Change, Insert, Delete, Unchanged };
@@ -185,27 +185,27 @@
m_conflicts = conflicts;
}
+ bool isUnsaved() const
+ {
+ return m_unsaved;
+ }
+ void setUnsaved( bool unsaved )
+ {
+ m_unsaved = unsaved;
+ }
+
void apply( bool apply );
bool applied() const { return m_applied; }
void setType( int type ) { m_type = type; }
- void addSourceLine( const QString& line );
- void addDestinationLine( const QString& line );
+ void addSourceLine( QString line );
+ void addDestinationLine( QString line );
/** This method will calculate the differences between the individual strings and store them as Markers */
void determineInlineDifferences();
QString recreateDifference() const;
-
- void reverse() {
- int l = m_sourceLineNo;
- m_sourceLineNo = m_destinationLineNo;
- m_destinationLineNo = l;
- DifferenceStringList t = m_destinationLines;
- m_destinationLines = m_sourceLines;
- m_sourceLines = t;
- }
private:
int m_type;
@@ -218,13 +218,12 @@
bool m_applied;
bool m_conflicts;
-
- LevenshteinTable* m_table;
+ bool m_unsaved;
};
-typedef Q3ValueList DifferenceList;
-typedef Q3ValueList::iterator DifferenceListIterator;
-typedef Q3ValueList::const_iterator DifferenceListConstIterator;
+typedef QList DifferenceList;
+typedef QList::iterator DifferenceListIterator;
+typedef QList::const_iterator DifferenceListConstIterator;
} // End of namespace Diff2
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffhunk.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffhunk.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffhunk.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffhunk.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,9 @@
/***************************************************************************
- diffhunk.cpp - description
- -------------------
+ diffhunk.cpp
+ ------------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2004,2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -15,13 +15,13 @@
**
***************************************************************************/
-
#include "diffhunk.h"
+
#include "difference.h"
using namespace Diff2;
-DiffHunk::DiffHunk( int sourceLine, int destinationLine, const QString& function, Type type ) :
+DiffHunk::DiffHunk( int sourceLine, int destinationLine, QString function, Type type ) :
m_sourceLine( sourceLine ),
m_destinationLine( destinationLine ),
m_function( function ),
@@ -31,6 +31,7 @@
DiffHunk::~DiffHunk()
{
+ qDeleteAll( m_differences );
}
void DiffHunk::add( Difference* diff )
@@ -99,7 +100,7 @@
.arg( m_sourceLine )
.arg( m_destinationLine )
.arg( slc )
- .arg( dlc );
+ .arg( dlc );
if ( !m_function.isEmpty() )
hunk += ' ' + m_function;
@@ -108,6 +109,6 @@
hunk += differences;
- kDebug( 8101 ) << hunk;
+ kDebug( 8101 ) << hunk << endl;
return hunk;
}
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffhunk.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffhunk.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffhunk.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffhunk.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,9 @@
/***************************************************************************
- diffhunk.h - description
- -------------------
+ diffhunk.h
+ ----------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2004,2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -19,8 +19,7 @@
#define DIFFHUNK_H
#include "difference.h"
-//Added by qt3to4:
-#include
+
namespace Diff2
{
@@ -33,7 +32,7 @@
enum Type { Normal, AddedByBlend };
public:
- DiffHunk( int sourceLine, int destinationLine, const QString& function = QString(), Type type = Normal );
+ DiffHunk( int sourceLine, int destinationLine, QString function = QString(), Type type = Normal );
~DiffHunk();
const DifferenceList& differences() const { return m_differences; };
@@ -45,21 +44,13 @@
int sourceLineCount() const;
int destinationLineCount() const;
- const Type type() const { return m_type; }
+ Type type() const { return m_type; }
void setType( Type type ) { m_type = type; }
void add( Difference* diff );
QString recreateHunk() const;
- void reverse() {
- int t = m_destinationLine;
- m_destinationLine = m_sourceLine;
- m_sourceLine = t;
- for(int a = 0; a < m_differences.size(); ++a)
- m_differences[a]->reverse();
- }
-
private:
int m_sourceLine;
int m_destinationLine;
@@ -68,9 +59,9 @@
Type m_type;
};
-typedef Q3ValueList DiffHunkList;
-typedef Q3ValueList::iterator DiffHunkListIterator;
-typedef Q3ValueList::const_iterator DiffHunkListConstIterator;
+typedef QList DiffHunkList;
+typedef QList::iterator DiffHunkListIterator;
+typedef QList::const_iterator DiffHunkListConstIterator;
} // End of namespace Diff2
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodel.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodel.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodel.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodel.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,9 @@
/***************************************************************************
- diffmodel.cpp - description
- -------------------
+ diffmodel.cpp
+ -------------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -16,8 +16,8 @@
***************************************************************************/
#include "diffmodel.h"
-#include
-#include
+
+#include
#include
#include
@@ -40,7 +40,6 @@
m_sourceRevision( "" ),
m_destinationRevision( "" ),
m_appliedCount( 0 ),
- m_modified( false ),
m_diffIndex( 0 ),
m_selectedDifference( 0 ),
m_blended( false )
@@ -61,7 +60,6 @@
m_sourceRevision( "" ),
m_destinationRevision( "" ),
m_appliedCount( 0 ),
- m_modified( false ),
m_diffIndex( 0 ),
m_selectedDifference( 0 ),
m_blended( false )
@@ -71,6 +69,9 @@
/** */
DiffModel::~DiffModel()
{
+ m_selectedDifference = 0;
+
+ qDeleteAll( m_hunks );
}
void DiffModel::splitSourceInPathAndFileName()
@@ -85,7 +86,7 @@
else
m_sourceFile = m_source;
- kDebug(8101) << m_source << "was split into" << m_sourcePath << "and" << m_sourceFile;
+ kDebug(8101) << m_source << " was split into " << m_sourcePath << " and " << m_sourceFile << endl;
}
void DiffModel::splitDestinationInPathAndFileName()
@@ -98,9 +99,9 @@
if( ( pos = m_destination.lastIndexOf( "/" ) ) >= 0 )
m_destinationFile = m_destination.mid( pos+1, m_destination.length() - pos );
else
- m_destinationFile = m_source;
+ m_destinationFile = m_destination;
- kDebug(8101) << m_destination << "was split into" << m_destinationPath << "and" << m_destinationFile;
+ kDebug(8101) << m_destination << " was split into " << m_destinationPath << " and " << m_destinationFile << endl;
}
DiffModel& DiffModel::operator=( const DiffModel& model )
@@ -118,7 +119,6 @@
m_destinationTimestamp = model.m_destinationTimestamp;
m_destinationRevision = model.m_destinationRevision;
m_appliedCount = model.m_appliedCount;
- m_modified = model.m_modified;
m_diffIndex = model.m_diffIndex;
m_selectedDifference = model.m_selectedDifference;
@@ -136,6 +136,9 @@
int DiffModel::localeAwareCompareSource( const DiffModel& model )
{
+ kDebug(8101) << "Path: " << model.m_sourcePath << endl;
+ kDebug(8101) << "File: " << model.m_sourceFile << endl;
+
int result = m_sourcePath.localeAwareCompare( model.m_sourcePath );
if ( result == 0 )
@@ -174,39 +177,11 @@
return diff;
}
-DifferenceList* DiffModel::allDifferences()
-{
- if ( m_hunks.count() != 0 )
- {
- DiffHunkListConstIterator hunkIt = m_hunks.begin();
- DiffHunkListConstIterator hEnd = m_hunks.end();
-
- for ( ; hunkIt != hEnd; ++hunkIt )
- {
- DiffHunk* hunk = *hunkIt;
-
- DifferenceListConstIterator diffIt = hunk->differences().begin();
- DifferenceListConstIterator dEnd = hunk->differences().end();
-
- for ( ; diffIt != dEnd; ++diffIt )
- {
- m_allDifferences.append( *diffIt );
- }
- }
- return &m_allDifferences;
- }
- else
- {
- DifferenceList *diffList = new DifferenceList;
- return diffList;
- }
-}
-
Difference* DiffModel::firstDifference()
{
- kDebug( 8101 ) << "DiffModel::firstDifference()";
+ kDebug(8101) << "DiffModel::firstDifference()" << endl;
m_diffIndex = 0;
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
m_selectedDifference = m_differences[ m_diffIndex ];
@@ -215,9 +190,9 @@
Difference* DiffModel::lastDifference()
{
- kDebug( 8101 ) << "DiffModel::lastDifference()";
+ kDebug(8101) << "DiffModel::lastDifference()" << endl;
m_diffIndex = m_differences.count() - 1;
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
m_selectedDifference = m_differences[ m_diffIndex ];
@@ -226,17 +201,17 @@
Difference* DiffModel::prevDifference()
{
- kDebug( 8101 ) << "DiffModel::prevDifference()";
- if ( --m_diffIndex < m_differences.count() )
+ kDebug(8101) << "DiffModel::prevDifference()" << endl;
+ if ( m_diffIndex > 0 && --m_diffIndex < m_differences.count() )
{
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
m_selectedDifference = m_differences[ m_diffIndex ];
}
else
{
m_selectedDifference = 0;
m_diffIndex = 0;
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
}
return m_selectedDifference;
@@ -244,17 +219,17 @@
Difference* DiffModel::nextDifference()
{
- kDebug( 8101 ) << "DiffModel::nextDifference()";
+ kDebug(8101) << "DiffModel::nextDifference()" << endl;
if ( ++m_diffIndex < m_differences.count() )
{
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
m_selectedDifference = m_differences[ m_diffIndex ];
}
else
{
m_selectedDifference = 0;
m_diffIndex = 0; // just for safety...
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
}
return m_selectedDifference;
@@ -280,34 +255,34 @@
return m_destinationPath;
}
-void DiffModel::setSourceFile( const QString& path )
+void DiffModel::setSourceFile( QString path )
{
m_source = path;
splitSourceInPathAndFileName();
}
-void DiffModel::setDestinationFile( const QString& path )
+void DiffModel::setDestinationFile( QString path )
{
m_destination = path;
splitDestinationInPathAndFileName();
}
-void DiffModel::setSourceTimestamp( const QString& timestamp )
+void DiffModel::setSourceTimestamp( QString timestamp )
{
m_sourceTimestamp = timestamp;
}
-void DiffModel::setDestinationTimestamp( const QString& timestamp )
+void DiffModel::setDestinationTimestamp( QString timestamp )
{
m_destinationTimestamp = timestamp;
}
-void DiffModel::setSourceRevision( const QString& revision )
+void DiffModel::setSourceRevision( QString revision )
{
- m_destinationRevision = revision;
+ m_sourceRevision = revision;
}
-void DiffModel::setDestinationRevision( const QString& revision )
+void DiffModel::setDestinationRevision( QString revision )
{
m_destinationRevision = revision;
}
@@ -322,6 +297,20 @@
m_differences.append( diff );
}
+bool DiffModel::hasUnsavedChanges( void ) const
+{
+ DifferenceListConstIterator diffIt = m_differences.begin();
+ DifferenceListConstIterator endIt = m_differences.end();
+
+ for ( ; diffIt != endIt; ++diffIt )
+ {
+ if ( (*diffIt)->isUnsaved() )
+ return true;
+ }
+
+ return false;
+}
+
void DiffModel::applyDifference( bool apply )
{
if ( apply && !m_selectedDifference->applied() )
@@ -329,43 +318,20 @@
else if ( !apply && m_selectedDifference->applied() )
m_appliedCount--;
- bool modified;
-
- // Not setting the m_modified yet so i can still query the current
- // modified status from the slot that is connected to the signal
- if ( m_appliedCount == 0 )
- modified = false;
- else
- modified = true;
-
- emit setModified( modified );
-
- m_modified = modified;
-
m_selectedDifference->apply( apply );
}
void DiffModel::applyAllDifferences( bool apply )
{
- bool modified;
-
- // Not setting the m_modified yet so i can still query the current
- // modified status from the slot that is connected to the signal
if ( apply )
{
m_appliedCount = m_differences.count();
- modified = true;
}
else
{
m_appliedCount = 0;
- modified = false;
}
- emit setModified( modified );
-
- m_modified = modified;
-
DifferenceListIterator diffIt = m_differences.begin();
DifferenceListIterator dEnd = m_differences.end();
@@ -375,33 +341,22 @@
}
}
-void DiffModel::slotSetModified( bool modified )
-{
- // Not setting the m_modified yet so i can still query the current
- // modified status from the slot that is connected to the signal
- emit setModified( modified );
-
- m_modified = modified;
-}
-
bool DiffModel::setSelectedDifference( Difference* diff )
{
- kDebug(8101) << "diff =" << diff;
- kDebug(8101) << "m_selectedDifference =" << m_selectedDifference;
+ kDebug(8101) << "diff = " << diff << endl;
+ kDebug(8101) << "m_selectedDifference = " << m_selectedDifference << endl;
if ( diff != m_selectedDifference )
{
- if ( ( findItem( diff, m_differences ) ) == -1 )
+ if ( ( m_differences.indexOf( diff ) ) == -1 )
return false;
// Do not set m_diffIndex if it cant be found
- m_diffIndex = findItem( diff, m_differences );
- kDebug( 8101 ) << "m_diffIndex =" << m_diffIndex;
+ m_diffIndex = m_differences.indexOf( diff );
+ kDebug(8101) << "m_diffIndex = " << m_diffIndex << endl;
m_selectedDifference = diff;
}
return true;
}
-#include "diffmodel.moc"
-
/* vim: set ts=4 sw=4 noet: */
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodel.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodel.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodel.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodel.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,9 @@
/***************************************************************************
- diffmodel.h - description
- -------------------
+ diffmodel.h
+ -----------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2004,2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -18,52 +18,31 @@
#ifndef DIFFMODEL_H
#define DIFFMODEL_H
-#include
-#include
+#include
+#include
#include "diffhunk.h"
#include "kompare.h"
-
-#include "diffexport.h"
+#include "diff2export.h"
namespace Diff2
{
- template
- int findItem( const Item& item, const Container* container ) {
- int i = 0;
- foreach( Item it, *container ) {
- if( it == item )
- return i;
- i++;
- }
- return -1;
- }
-
-template
-int findItem( const Pointer* item, const DifferenceList& container ) {
- int i = 0;
- foreach( Difference* it, container ) {
- if( it == item )
- return i;
- i++;
- }
- return -1;
-}
-
class DiffHunk;
class Difference;
-class DiffModel : public QObject
+class DIFF2_EXPORT DiffModel
{
-Q_OBJECT
public:
DiffModel( const QString& srcBaseURL, const QString& destBaseURL );
DiffModel();
- DiffModel( const DiffModel& ) : QObject() {};
~DiffModel();
+private:
+ DiffModel( const DiffModel& ) {};
+
+public:
int parseDiff( enum Kompare::Format format, const QStringList& list );
QString recreateDiff() const;
@@ -72,20 +51,15 @@
int differenceCount() const { return m_differences.count(); }
int appliedCount() const { return m_appliedCount; }
- DiffHunk* hunkAt( int i ) { return *( m_hunks.at( i ) ); }
- const Difference* differenceAt( int i ) { return *( m_differences.at( i ) ); }
+ DiffHunk* hunkAt( int i ) { return ( m_hunks.at( i ) ); }
+ const Difference* differenceAt( int i ) { return ( m_differences.at( i ) ); }
DiffHunkList* hunks() { return &m_hunks; }
const DiffHunkList* hunks() const { return &m_hunks; }
DifferenceList* differences() { return &m_differences; }
const DifferenceList* differences() const { return &m_differences; }
- DifferenceList* allDifferences();
-
- int findDifference( Difference* diff ) const {
- return findItem( diff, m_differences );
- }
- //return m_differences.( diff ); }
+ int findDifference( Difference* diff ) const { return m_differences.indexOf( diff ); }
Difference* firstDifference();
Difference* lastDifference();
@@ -103,19 +77,19 @@
const QString sourceRevision() const { return m_sourceRevision; }
const QString destinationRevision() const { return m_destinationRevision; }
- void setSourceFile( const QString& path );
- void setDestinationFile( const QString& path );
- void setSourceTimestamp( const QString& timestamp );
- void setDestinationTimestamp( const QString& timestamp );
- void setSourceRevision( const QString& revision );
- void setDestinationRevision( const QString& revision );
+ void setSourceFile( QString path );
+ void setDestinationFile( QString path );
+ void setSourceTimestamp( QString timestamp );
+ void setDestinationTimestamp( QString timestamp );
+ void setSourceRevision( QString revision );
+ void setDestinationRevision( QString revision );
void addHunk( DiffHunk* hunk );
void addDiff( Difference* diff );
- bool isModified() const { return m_modified; }
+ bool hasUnsavedChanges() const;
- const int diffIndex( void ) const { return m_diffIndex; }
- void setDiffIndex( int diffIndex ) { m_diffIndex = diffIndex; }
+ int diffIndex( void ) const { return m_diffIndex; }
+ void setDiffIndex( int diffIndex ) { m_diffIndex = diffIndex; }
void applyDifference( bool apply );
void applyAllDifferences( bool apply );
@@ -130,12 +104,6 @@
bool isBlended() const { return m_blended; }
void setBlended( bool blended ) { m_blended = blended; }
-signals:
- void setModified( bool modified );
-
-public slots:
- void slotSetModified( bool modified );
-
private:
void splitSourceInPathAndFileName();
void splitDestinationInPathAndFileName();
@@ -158,12 +126,10 @@
DiffHunkList m_hunks;
DifferenceList m_differences;
- DifferenceList m_allDifferences;
int m_appliedCount;
- bool m_modified;
- unsigned int m_diffIndex;
+ int m_diffIndex;
Difference* m_selectedDifference;
bool m_blended;
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodellist.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodellist.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodellist.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodellist.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -2,7 +2,7 @@
**
** Filename : diffmodellist.cpp
** Created on : 26 march, 2004
-** Copyright : (c) 2004 Otto Bruggeman
+** Copyright 2004 Otto Bruggeman
**
*******************************************************************************/
@@ -16,13 +16,17 @@
*******************************************************************************/
#include "diffmodellist.h"
+
#include
-#include
using namespace Diff2;
-void DiffModelList::sort()
+bool diffModelCompare(DiffModel* model1, DiffModel* model2)
{
- qHeapSort(*this);
+ return *model1 < *model2;
}
+void DiffModelList::sort()
+{
+ qSort(begin(), end(), diffModelCompare);
+}
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodellist.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodellist.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffmodellist.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffmodellist.h 2010-07-17 19:58:27.000000000 +0100
@@ -2,7 +2,7 @@
**
** Filename : diffmodellist.h
** Created on : 24 januari, 2004
- copyright : (C) 2001-2003 Otto Bruggeman
+** Copyright 2004-2005, 2009 Otto Bruggeman
**
*******************************************************************************/
@@ -18,24 +18,27 @@
#ifndef DIFFMODELLIST_H
#define DIFFMODELLIST_H
-#include // include for the base class
+#include // include for the base class
#include "diffmodel.h"
+#include "diff2export.h"
namespace Diff2
{
-typedef Q3ValueListIterator DiffModelListIterator;
-typedef Q3ValueListConstIterator DiffModelListConstIterator;
+typedef QList::Iterator DiffModelListIterator;
+typedef QList::ConstIterator DiffModelListConstIterator;
-class DiffModelList : public Q3ValueList
+class DIFF2_EXPORT DiffModelList : public QList
{
public:
DiffModelList() {}
- DiffModelList( const DiffModelList &list ) : Q3ValueList( list ) {}
+ DiffModelList( const DiffModelList &list ) : QList( list ) {}
virtual ~DiffModelList()
{
- clear();
+ // Memleak as indicated by valgrind
+ while ( !isEmpty() )
+ delete takeFirst();
}
public:
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffparser.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffparser.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffparser.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffparser.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -2,8 +2,7 @@
** diffparser.cpp
** --------------
** begin : Sun Aug 4 15:05:35 2002
-** copyright : (C) 2002-2004 Otto Bruggeman
-**
+** Copyright 2002-2004 Otto Bruggeman
***************************************************************************/
/***************************************************************************
**
@@ -15,10 +14,10 @@
***************************************************************************/
#include "diffparser.h"
-#include
-#include
+#include
+#include
using namespace Diff2;
@@ -35,7 +34,7 @@
enum Kompare::Format DiffParser::determineFormat()
{
- kDebug(8101) << "Determining the format of the diff Diff";
+ kDebug(8101) << "Determining the format of the diff Diff" << m_diffLines << endl;
QRegExp normalRE ( "[0-9]+[0-9,]*[acd][0-9]+[0-9,]*" );
QRegExp unifiedRE( "^--- " );
@@ -47,34 +46,34 @@
while( it != m_diffLines.end() )
{
- kDebug(8101) << (*it);
- if( (*it).indexOf( normalRE, 0 ) == 0 )
+ kDebug(8101) << (*it) << endl;
+ if( it->indexOf( normalRE, 0 ) == 0 )
{
- kDebug(8101) << "Difflines are from a Normal diff...";
+ kDebug(8101) << "Difflines are from a Normal diff..." << endl;
return Kompare::Normal;
}
- else if( (*it).indexOf( unifiedRE, 0 ) == 0 )
+ else if( it->indexOf( unifiedRE, 0 ) == 0 )
{
- kDebug(8101) << "Difflines are from a Unified diff...";
+ kDebug(8101) << "Difflines are from a Unified diff..." << endl;
return Kompare::Unified;
}
- else if( (*it).indexOf( contextRE, 0 ) == 0 )
+ else if( it->indexOf( contextRE, 0 ) == 0 )
{
- kDebug(8101) << "Difflines are from a Context diff...";
+ kDebug(8101) << "Difflines are from a Context diff..." << endl;
return Kompare::Context;
}
- else if( (*it).indexOf( rcsRE, 0 ) == 0 )
+ else if( it->indexOf( rcsRE, 0 ) == 0 )
{
- kDebug(8101) << "Difflines are from an RCS diff...";
+ kDebug(8101) << "Difflines are from an RCS diff..." << endl;
return Kompare::RCS;
}
- else if( (*it).indexOf( edRE, 0 ) == 0 )
+ else if( it->indexOf( edRE, 0 ) == 0 )
{
- kDebug(8101) << "Difflines are from an ED diff...";
+ kDebug(8101) << "Difflines are from an ED diff..." << endl;
return Kompare::Ed;
}
++it;
}
- kDebug(8101) << "Difflines are from an unknown diff...";
+ kDebug(8101) << "Difflines are from an unknown diff..." << endl;
return Kompare::UnknownFormat;
}
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffparser.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffparser.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffparser.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffparser.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,8 @@
/**************************************************************************
** diffparser.h
-** -----------------
+** ------------
** begin : Sun Aug 4 15:05:35 2002
- copyright : (C) 2001-2003 Otto Bruggeman
-**
+** Copyright 2002-2004 Otto Bruggeman
***************************************************************************/
/***************************************************************************
**
@@ -14,8 +13,8 @@
**
***************************************************************************/
-#ifndef _DIFF_PARSER_H
-#define _DIFF_PARSER_H
+#ifndef DIFFPARSER_H
+#define DIFFPARSER_H
#include "parserbase.h"
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffsettings.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffsettings.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffsettings.cpp 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffsettings.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,111 +0,0 @@
-/***************************************************************************
- diffsettings.cpp - description
- -------------------
- begin : Sun Mar 4 2001
- copyright : (C) 2001-2004 Otto Bruggeman
-****************************************************************************/
-
-/***************************************************************************
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-****************************************************************************/
-
-#include "diffsettings.h"
-#include
-
-
-DiffSettings::DiffSettings( QWidget* parent )
- : SettingsBase( parent ),
- m_linesOfContext( 0 ),
- m_format( Kompare::Unified ),
- m_largeFiles( false ),
- m_ignoreWhiteSpace( false ),
- m_ignoreAllWhiteSpace( false ),
- m_ignoreEmptyLines( false ),
- m_ignoreChangesDueToTabExpansion( false ),
- m_createSmallerDiff( false ),
- m_ignoreChangesInCase( false ),
- m_showCFunctionChange( false ),
- m_convertTabsToSpaces( false ),
- m_ignoreRegExp( false ),
- m_recursive( false ),
- m_newFiles( false ),
- m_excludeFilePattern( false ),
- m_excludeFilesFile( false )
-{
-}
-
-DiffSettings::~DiffSettings()
-{
-}
-
-void DiffSettings::loadSettings( KConfig* config )
-{
- Q_UNUSED( config );
- /*
- KConfigGroup group( config, "Diff Options" );
- m_diffProgram = group.readEntry ( "DiffProgram", "" );
- m_linesOfContext = group.readEntry( "LinesOfContext", QVariant(3) ).asInt();
- m_largeFiles = group.readBoolEntry( "LargeFiles", true );
- m_ignoreWhiteSpace = group.readBoolEntry( "IgnoreWhiteSpace", false );
- m_ignoreAllWhiteSpace = group.readBoolEntry( "IgnoreAllWhiteSpace", false );
- m_ignoreEmptyLines = group.readBoolEntry( "IgnoreEmptyLines", false );
- m_ignoreChangesDueToTabExpansion = group.readBoolEntry( "IgnoreChangesDueToTabExpansion", false );
- m_ignoreChangesInCase = group.readBoolEntry( "IgnoreChangesInCase", false );
- m_ignoreRegExp = group.readBoolEntry( "IgnoreRegExp", false );
- m_ignoreRegExpText = group.readEntry ( "IgnoreRegExpText", "" );
- m_ignoreRegExpTextHistory = group.readListEntry( "IgnoreRegExpTextHistory" );
- m_createSmallerDiff = group.readBoolEntry( "CreateSmallerDiff", true );
- m_convertTabsToSpaces = group.readBoolEntry( "ConvertTabsToSpaces", false );
- m_showCFunctionChange = group.readBoolEntry( "ShowCFunctionChange", false );
- m_recursive = group.readBoolEntry( "CompareRecursively", true );
- m_newFiles = group.readBoolEntry( "NewFiles", true );
-
- m_format = static_cast( group.readNumEntry( "Format", Kompare::Unified ) );
-
- KConfigGroup group2 ( config, "Exclude File Options" );
- m_excludeFilePattern = group2.readBoolEntry( "Pattern", false );
- m_excludeFilePatternList = group2.readListEntry( "PatternList" );
- m_excludeFilesFile = group2.readBoolEntry( "File", false );
- m_excludeFilesFileURL = group2.readEntry ( "FileURL", "" );
- m_excludeFilesFileHistoryList = group2.readListEntry( "FileHistoryList" );*/
-}
-
-void DiffSettings::saveSettings( KConfig* config )
-{
- Q_UNUSED( config );
- /*
- KConfigGroup group( config, "Diff Options" );
- group.writeEntry( "DiffProgram", m_diffProgram );
- group.writeEntry( "LinesOfContext", m_linesOfContext );
- group.writeEntry( "Format", QString(m_format) );
- group.writeEntry( "LargeFiles", m_largeFiles );
- group.writeEntry( "IgnoreWhiteSpace", m_ignoreWhiteSpace );
- group.writeEntry( "IgnoreAllWhiteSpace", m_ignoreAllWhiteSpace );
- group.writeEntry( "IgnoreEmptyLines", m_ignoreEmptyLines );
- group.writeEntry( "IgnoreChangesInCase", m_ignoreChangesInCase );
- group.writeEntry( "IgnoreChangesDueToTabExpansion", m_ignoreChangesDueToTabExpansion );
- group.writeEntry( "IgnoreRegExp", m_ignoreRegExp );
- group.writeEntry( "IgnoreRegExpText", m_ignoreRegExpText );
- group.writeEntry( "IgnoreRegExpTextHistory", m_ignoreRegExpTextHistory );
- group.writeEntry( "CreateSmallerDiff", m_createSmallerDiff );
- group.writeEntry( "ConvertTabsToSpaces", m_convertTabsToSpaces );
- group.writeEntry( "ShowCFunctionChange", m_showCFunctionChange );
- group.writeEntry( "CompareRecursively", m_recursive );
- group.writeEntry( "NewFiles", m_newFiles );
- group.setDirty( true );
-
- KConfigGroup group2( config, "Exclude File Options" );
- group2.writeEntry( "Pattern", m_excludeFilePattern );
- group2.writeEntry( "PatternList", m_excludeFilePatternList );
- group2.writeEntry( "File", m_excludeFilesFile );
- group2.writeEntry( "FileURL", m_excludeFilesFileURL );
- group2.writeEntry( "FileHistoryList", m_excludeFilesFileHistoryList );
- group2.setDirty( true );*/
-}
-
-#include "diffsettings.moc"
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffsettings.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffsettings.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/diffsettings.h 2009-08-30 21:19:19.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/diffsettings.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,66 +0,0 @@
-/***************************************************************************
- diffsettings.h - description
- -------------------
- begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
-****************************************************************************/
-
-/***************************************************************************
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-***************************************************************************/
-
-#ifndef DIFFSETTINGS_H
-#define DIFFSETTINGS_H
-
-#include
-#include
-
-#include "kompare.h"
-#include "settingsbase.h"
-
-#include "diffexport.h"
-
-class DiffSettings : public SettingsBase
-{
-Q_OBJECT
-public:
- DiffSettings( QWidget* parent );
- virtual ~DiffSettings();
-public:
- // some virtual functions that will be overloaded from the base class
- virtual void loadSettings( KConfig* config );
- virtual void saveSettings( KConfig* config );
-
-public:
- QString m_diffProgram;
- int m_linesOfContext;
- Kompare::Format m_format;
- bool m_largeFiles; // -H
- bool m_ignoreWhiteSpace; // -b
- bool m_ignoreAllWhiteSpace; // -w
- bool m_ignoreEmptyLines; // -B
- bool m_ignoreChangesDueToTabExpansion; // -E
- bool m_createSmallerDiff; // -d
- bool m_ignoreChangesInCase; // -i
- bool m_showCFunctionChange; // -p
- bool m_convertTabsToSpaces; // -t
- bool m_ignoreRegExp; // -I
- QString m_ignoreRegExpText; // the RE for -I
- QStringList m_ignoreRegExpTextHistory;
- bool m_recursive; // -r
- bool m_newFiles; // -N
-// bool m_allText; // -a
- bool m_excludeFilePattern; // -x
- QStringList m_excludeFilePatternList; // The list of patterns for -x
- bool m_excludeFilesFile; // -X
- QString m_excludeFilesFileURL; // The filename to -X
- QStringList m_excludeFilesFileHistoryList; // The history list of filenames
-};
-
-#endif
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/kompare.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/kompare.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/kompare.h 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/kompare.h 2010-07-17 19:58:27.000000000 +0100
@@ -2,8 +2,8 @@
kompare.h - description
-------------------
begin : Sun Mar 4 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2003 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
****************************************************************************/
/***************************************************************************
@@ -20,6 +20,11 @@
#include
+#include "diff2export.h"
+
+// Forward declaration needed
+class KTempDir;
+
namespace Kompare
{
enum Format {
@@ -47,12 +52,14 @@
};
enum Mode {
- ComparingFiles, // compareFiles
- ComparingDirs, // compareDirs
- ShowingDiff, // openDiff
- BlendingDir, // openDirAnfDiff
- BlendingFile, // openFileAndDiff
- UnknownMode // Used to initialize the Infoi struct
+ ComparingFiles, // compareFiles
+ ComparingFileString, // Compare a source file with a destination string
+ ComparingStringFile, // Compare a source string with a destination file
+ ComparingDirs, // compareDirs
+ ShowingDiff, // openDiff
+ BlendingDir, // openDirAnfDiff
+ BlendingFile, // openFileAndDiff
+ UnknownMode // Used to initialize the Infoi struct
};
enum DiffMode {
@@ -74,9 +81,7 @@
Destination
};
- class Info {
- public:
-
+ struct Info {
Info (
enum Mode _mode = UnknownMode,
enum DiffMode _diffMode = UnknownDiffMode,
@@ -85,7 +90,9 @@
KUrl _source = KUrl(),
KUrl _destination = KUrl(),
QString _localSource = "",
- QString _localDestination = ""
+ QString _localDestination = "",
+ KTempDir* _sourceKTempDir = 0,
+ KTempDir* _destinationKTempDir = 0
)
{
mode = _mode;
@@ -96,6 +103,22 @@
destination = _destination;
localSource = _localSource;
localDestination = _localDestination;
+ sourceKTempDir = _sourceKTempDir;
+ destinationKTempDir = _destinationKTempDir;
+ }
+ void swapSourceWithDestination()
+ {
+ KUrl url = source;
+ source = destination;
+ destination = url;
+
+ QString string = localSource;
+ localSource = localDestination;
+ localDestination = string;
+
+ KTempDir* tmpDir = sourceKTempDir;
+ sourceKTempDir = destinationKTempDir;
+ destinationKTempDir = tmpDir;
}
enum Mode mode;
enum DiffMode diffMode;
@@ -105,13 +128,15 @@
KUrl destination;
QString localSource;
QString localDestination;
+ KTempDir* sourceKTempDir;
+ KTempDir* destinationKTempDir;
};
} // End of namespace Kompare
/*
** This should be removed and put somewhere else
*/
-class KompareFunctions
+class DIFF2_EXPORT KompareFunctions
{
public:
static QString constructRelativePath( const QString& from, const QString& to )
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/komparemodellist.cpp kdevplatform-1.0.1/plugins/patchreview/libdiff2/komparemodellist.cpp
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/komparemodellist.cpp 2009-11-26 15:15:34.000000000 +0000
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/komparemodellist.cpp 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,10 @@
/***************************************************************************
- komparemodellist.cpp - description
- -------------------
+ komparemodellist.cpp
+ --------------------
begin : Tue Jun 26 2001
- copyright : (C) 2001-2004 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2005,2009 Otto Bruggeman
+ Copyright 2001-2003 John Firebaugh
+ Copyright 2007-2009 Kevin Kofler
***************************************************************************/
/***************************************************************************
@@ -16,22 +17,24 @@
***************************************************************************/
#include "komparemodellist.h"
-#include
-#include
-#include
-#include
-#include
-#include
+
+#include
+#include
+#include
+#include
+#include
+#include
#include
+#include
#include
#include
#include
#include
#include
#include
-#include
-#include
+#include
+#include
#include "difference.h"
#include "diffhunk.h"
@@ -39,61 +42,70 @@
#include "diffmodellist.h"
#include "kompareprocess.h"
#include "parser.h"
-#include
-
-//#include "kompareplugin.h"
using namespace Diff2;
-KompareModelList::KompareModelList( DiffSettings* diffSettings, Kompare::Info& info, QObject* parent, const char* name )
+KompareModelList::KompareModelList( DiffSettings* diffSettings, QWidget* widgetForKIO, QObject* parent, const char* name )
: QObject( parent ),
m_diffProcess( 0 ),
m_diffSettings( diffSettings ),
m_models( 0 ),
m_selectedModel( 0 ),
m_selectedDifference( 0 ),
- m_noOfModified( 0 ),
m_modelIndex( 0 ),
- m_info( info ),
- m_textCodec( 0 )
-{
- Q_UNUSED( name );
- m_applyDifference = m_unApplyDifference = m_applyAll = m_unapplyAll = m_previousFile = m_nextFile = m_previousDifference = m_nextDifference = m_save = 0;
-/* m_applyDifference = new KAction( i18n("&Apply Difference"), "1rightarrow", Qt::Key_Space,
- this, SLOT(slotActionApplyDifference()),
- (( KomparePart* )parent)->actionCollection(), "difference_apply" );
- m_unApplyDifference = new KAction( i18n("Un&apply Difference"), "1leftarrow", Qt::Key_Backspace,
- this, SLOT(slotActionUnApplyDifference()),
- (( KomparePart* )parent)->actionCollection(), "difference_unapply" );
- m_applyAll = new KAction( i18n("App&ly All"), "2rightarrow", Qt::CTRL + Qt::Key_A,
- this, SLOT(slotActionApplyAllDifferences()),
- (( KomparePart* )parent)->actionCollection(), "difference_applyall" );
- m_unapplyAll = new KAction( i18n("&Unapply All"), "2leftarrow", Qt::CTRL + Qt::Key_U,
- this, SLOT(slotActionUnapplyAllDifferences()),
- (( KomparePart* )parent)->actionCollection(), "difference_unapplyall" );
- m_previousFile = new KAction( i18n("P&revious File"), "2uparrow", Qt::CTRL + Qt::Key_PageUp,
- this, SLOT(slotPreviousModel()),
- (( KomparePart* )parent)->actionCollection(), "difference_previousfile" );
- m_nextFile = new KAction( i18n("N&ext File"), "2downarrow", Qt::CTRL + Qt::Key_PageDown,
- this, SLOT(slotNextModel()),
- (( KomparePart* )parent)->actionCollection(), "difference_nextfile" );
- m_previousDifference = new KAction( i18n("&Previous Difference"), "1uparrow", Qt::CTRL + Qt::Key_Up,
- this, SLOT(slotPreviousDifference()),
- (( KomparePart* )parent)->actionCollection(), "difference_previous" );
- m_nextDifference = new KAction( i18n("&Next Difference"), "1downarrow", Qt::CTRL + Qt::Key_Down,
- this, SLOT(slotNextDifference()),
- (( KomparePart* )parent)->actionCollection(), "difference_next" );
- m_previousDifference->setEnabled( false );
- m_nextDifference->setEnabled( false );*/
-
-/* m_save = KStdAction::save( this, SLOT(slotSaveDestination()), ((KomparePart*)parent)->actionCollection() );
- m_save->setEnabled( false );*/
+ m_info( 0 ),
+ m_textCodec( 0 ),
+ m_widgetForKIO( widgetForKIO )
+{
+ kDebug(8101) << "Show me the arguments: " << diffSettings << ", " << widgetForKIO << ", " << parent << ", " << name << endl;
+// KActionCollection *ac = new KActionCollection;
+// m_applyDifference = ac->addAction( "difference_apply", this, SLOT(slotActionApplyDifference()) );
+// m_applyDifference->setIcon( KIcon("arrow-right") );
+// m_applyDifference->setText( i18n("&Apply Difference") );
+// m_applyDifference->setShortcut( QKeySequence(Qt::Key_Space) );
+// m_unApplyDifference = ac->addAction( "difference_unapply", this, SLOT(slotActionUnApplyDifference()) );
+// m_unApplyDifference->setIcon( KIcon("arrow-left") );
+// m_unApplyDifference->setText( i18n("Un&apply Difference") );
+// m_unApplyDifference->setShortcut( QKeySequence(Qt::Key_Backspace) );
+// m_applyAll = ac->addAction( "difference_applyall", this, SLOT(slotActionApplyAllDifferences()) );
+// m_applyAll->setIcon( KIcon("arrow-right-double") );
+// m_applyAll->setText( i18n("App&ly All") );
+// m_applyAll->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_A) );
+// m_unapplyAll = ac->addAction( "difference_unapplyall", this, SLOT(slotActionUnapplyAllDifferences()) );
+// m_unapplyAll->setIcon( KIcon("arrow-left-double") );
+// m_unapplyAll->setText( i18n("&Unapply All") );
+// m_unapplyAll->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_U) );
+// m_previousFile = ac->addAction( "difference_previousfile", this, SLOT(slotPreviousModel()) );
+// m_previousFile->setIcon( KIcon("arrow-up-double") );
+// m_previousFile->setText( i18n("P&revious File") );
+// m_previousFile->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_PageUp) );
+// m_nextFile = ac->addAction( "difference_nextfile", this, SLOT(slotNextModel()) );
+// m_nextFile->setIcon( KIcon("arrow-down-double") );
+// m_nextFile->setText( i18n("N&ext File") );
+// m_nextFile->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_PageDown) );
+// m_previousDifference = ac->addAction( "difference_previous", this, SLOT(slotPreviousDifference()) );
+// m_previousDifference->setIcon( KIcon("arrow-up") );
+// m_previousDifference->setText( i18n("&Previous Difference") );
+// m_previousDifference->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_Up) );
+// m_nextDifference = ac->addAction( "difference_next", this, SLOT(slotNextDifference()) );
+// m_nextDifference->setIcon( KIcon("arrow-down") );
+// m_nextDifference->setText( i18n("&Next Difference") );
+// m_nextDifference->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_Down) );
+// m_previousDifference->setEnabled( false );
+// m_nextDifference->setEnabled( false );
+//
+// m_save = KStandardAction::save( this, SLOT(slotSaveDestination()), ac );
+// m_save->setEnabled( false );
updateModelListActions();
}
KompareModelList::~KompareModelList()
{
+ m_selectedModel = 0;
+ m_selectedDifference = 0;
+ m_info = 0;
+ delete m_models;
}
bool KompareModelList::isDirectory( const QString& url ) const
@@ -107,118 +119,85 @@
bool KompareModelList::isDiff( const QString& mimeType ) const
{
- if ( mimeType == "text/x-diff" )
+ if ( mimeType == "text/x-patch" )
return true;
else
return false;
}
-bool KompareModelList::compare( const QString& source, const QString& destination )
+bool KompareModelList::compare()
{
bool result = false;
- bool sourceIsDirectory = isDirectory( source );
- bool destinationIsDirectory = isDirectory( source );
+ bool sourceIsDirectory = isDirectory( m_info->localSource );
+ bool destinationIsDirectory = isDirectory( m_info->localDestination );
if ( sourceIsDirectory && destinationIsDirectory )
{
- m_info.mode = Kompare::ComparingDirs;
- result = compareDirs( source, destination );
+ m_info->mode = Kompare::ComparingDirs;
+ result = compare(m_info->mode);
}
else if ( !sourceIsDirectory && !destinationIsDirectory )
{
- QFile sourceFile( source );
+ QFile sourceFile( m_info->localSource );
sourceFile.open( QIODevice::ReadOnly );
QString sourceMimeType = ( KMimeType::findByContent( sourceFile.readAll() ) )->name();
sourceFile.close();
- kDebug(8101) << "Mimetype source :" << sourceMimeType;
+ kDebug(8101) << "Mimetype source : " << sourceMimeType << endl;
- QFile destinationFile( destination );
+ QFile destinationFile( m_info->localDestination );
destinationFile.open( QIODevice::ReadOnly );
QString destinationMimeType = ( KMimeType::findByContent( destinationFile.readAll() ) )->name();
destinationFile.close();
- kDebug(8101) << "Mimetype destination:" << destinationMimeType;
+ kDebug(8101) << "Mimetype destination: " << destinationMimeType << endl;
// Not checking if it is a text file/something diff can even compare, we'll let diff handle that
if ( !isDiff( sourceMimeType ) && isDiff( destinationMimeType ) )
{
- kDebug(8101) << "Blending destination into source...";
- m_info.mode = Kompare::BlendingFile;
- result = openFileAndDiff( source, destination );
+ kDebug(8101) << "Blending destination into source..." << endl;
+ m_info->mode = Kompare::BlendingFile;
+ result = openFileAndDiff();
}
else if ( isDiff( sourceMimeType ) && !isDiff( destinationMimeType ) )
{
- kDebug(8101) << "Blending source into destination...";
- m_info.mode = Kompare::BlendingFile;
- result = openFileAndDiff( destination, source );
+ kDebug(8101) << "Blending source into destination..." << endl;
+ m_info->mode = Kompare::BlendingFile;
+ // Swap source and destination before calling this
+ m_info->swapSourceWithDestination();
+ // Do we need to notify anyone we swapped source and destination?
+ // No we do not need to notify anyone about swapping source with destination
+ result = openFileAndDiff();
}
else
{
- kDebug(8101) << "Comparing source with destination";
- m_info.mode = Kompare::ComparingFiles;
- result = compareFiles( source, destination );
+ kDebug(8101) << "Comparing source with destination" << endl;
+ m_info->mode = Kompare::ComparingFiles;
+ result = compare(m_info->mode);
}
}
else if ( sourceIsDirectory && !destinationIsDirectory )
{
- m_info.mode = Kompare::BlendingDir;
- result = openDirAndDiff( source, destination );
+ m_info->mode = Kompare::BlendingDir;
+ result = openDirAndDiff();
}
else
{
- m_info.mode = Kompare::BlendingDir;
- result = openDirAndDiff( destination, source );
+ m_info->mode = Kompare::BlendingDir;
+ // Swap source and destination first in m_info
+ m_info->swapSourceWithDestination();
+ // Do we need to notify anyone we swapped source and destination?
+ // No we do not need to notify anyone about swapping source with destination
+ result = openDirAndDiff();
}
return result;
}
-bool KompareModelList::compareFiles( const QString& source, const QString& destination )
-{
- m_source = source;
- m_destination = destination;
-
- clear(); // Destroy the old models...
-
-// m_fileWatch = new KDirWatch( this, "filewatch" );
-// m_fileWatch->addFile( m_source );
-// m_fileWatch->addFile( m_destination );
-
-// connect( m_fileWatch, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileChanged( const QString& ) ) );
-// connect( m_fileWatch, SIGNAL( created( const QString& ) ), this, SLOT( slotFileChanged( const QString& ) ) );
-// connect( m_fileWatch, SIGNAL( deleted( const QString& ) ), this, SLOT( slotFileChanged( const QString& ) ) );
-
-// m_fileWatch->startScan();
- m_diffProcess = new KompareProcess( m_diffSettings, Kompare::Custom, m_source, m_destination );
- m_diffProcess->setEncoding( m_encoding );
-
- connect( m_diffProcess, SIGNAL(diffHasFinished( bool )),
- this, SLOT(slotDiffProcessFinished( bool )) );
-
- emit status( Kompare::RunningDiff );
- m_diffProcess->start();
-
- return true;
-}
-
-bool KompareModelList::compareDirs( const QString& source, const QString& destination )
+bool KompareModelList::compare(Kompare::Mode mode)
{
- m_source = source;
- m_destination = destination;
-
clear(); // Destroy the old models...
-// m_dirWatch = new KDirWatch( this, "dirwatch" );
- // Watch files in the dirs and watch the dirs recursively
-// m_dirWatch->addDir( m_source, true, true );
-// m_dirWatch->addDir( m_destination, true, true );
-
-// connect( m_dirWatch, SIGNAL( dirty ( const QString& ) ), this, SLOT( slotDirectoryChanged( const QString& ) ) );
-// connect( m_dirWatch, SIGNAL( created( const QString& ) ), this, SLOT( slotDirectoryChanged( const QString& ) ) );
-// connect( m_dirWatch, SIGNAL( deleted( const QString& ) ), this, SLOT( slotDirectoryChanged( const QString& ) ) );
-
-// m_dirWatch->startScan();
- m_diffProcess = new KompareProcess( m_diffSettings, Kompare::Custom, m_source, m_destination );
+ m_diffProcess = new KompareProcess( m_diffSettings, Kompare::Custom, m_info->localSource, m_info->localDestination, QString(), mode );
m_diffProcess->setEncoding( m_encoding );
connect( m_diffProcess, SIGNAL(diffHasFinished( bool )),
@@ -230,21 +209,20 @@
return true;
}
-bool KompareModelList::openFileAndDiff( const QString& file, const QString& diff )
+bool KompareModelList::openFileAndDiff()
{
clear();
- if ( parseDiffOutput( readFile( diff ) ) != 0 )
+ if ( parseDiffOutput( readFile( m_info->localDestination ) ) != 0 )
{
- emit error( i18n( "No models or no differences, this file: %1, is not a valid diff file.", diff ) );
+ emit error( i18n( "No models or no differences, this file: %1, is not a valid diff file.", m_info->destination.url() ) );
return false;
}
- // Do our thing :)
- if ( !blendOriginalIntoModelList( file ) )
+ if ( !blendOriginalIntoModelList( m_info->localSource ) )
{
- kDebug(8101) << "Oops cant blend original file into modellist :" << file;
- emit( i18n( "There were problems applying the diff %1 to the file %2.", diff, file ) );
+ kDebug(8101) << "Oops cant blend original file into modellist : " << m_info->localSource << endl;
+ emit( i18n( "There were problems applying the diff %1 to the file %2.", m_info->destination.url(), m_info->source.url() ) );
return false;
}
@@ -254,34 +232,22 @@
return true;
}
-bool KompareModelList::openDirAndDiff( const QString& dir, const QString& diff, bool reverse )
+bool KompareModelList::openDirAndDiff()
{
clear();
- if ( parseDiffOutput( readFile( diff ) ) != 0 )
+ if ( parseDiffOutput( readFile( m_info->localDestination ) ) != 0 )
{
- emit error( i18n( "No models or no differences, this file: %1, is not a valid diff file.", diff ) );
+ emit error( i18n( "No models or no differences, this file: %1, is not a valid diff file.", m_info->destination.url() ) );
return false;
}
- //Inverse the hunks
- if(reverse) {
- int mCount = modelCount();
- for(uint a = 0; a < mCount; ++a) {
- const Diff2::DiffModel* model = modelAt(a);
- int hunkCount = modelAt(a)->hunkCount();
- for(int h = 0; h < hunkCount; ++h) {
- (*(*const_cast(model->hunks())).at(h))->reverse();
- }
- }
- }
-
// Do our thing :)
- if ( !blendOriginalIntoModelList( dir ) )
+ if ( !blendOriginalIntoModelList( m_info->localSource ) )
{
// Trouble blending the original into the model
- kDebug(8101) << "Oops cant blend original dir into modellist :" << dir;
- emit error( i18n( "There were problems applying the diff %1 to the folder %2.", diff, dir ) );
+ kDebug(8101) << "Oops cant blend original dir into modellist : " << m_info->localSource << endl;
+ emit error( i18n( "There were problems applying the diff %1 to the folder %2.", m_info->destination.url(), m_info->source.url() ) );
return false;
}
@@ -293,40 +259,44 @@
void KompareModelList::slotSaveDestination()
{
+ // Unnecessary safety check! We can now guarantee that saving is only possible when there is a model and there are unsaved changes
if ( m_selectedModel )
{
saveDestination( m_selectedModel );
+ m_save->setEnabled( false );
+ emit updateActions();
}
}
bool KompareModelList::saveDestination( DiffModel* model )
{
- kDebug(9500) << "KompareModelList::saveDestination:";
+ kDebug(8101) << "KompareModelList::saveDestination: " << endl;
- if( !model->isModified() )
+ // Unecessary safety check, we can guarantee there are unsaved changes!!!
+ if( !model->hasUnsavedChanges() )
return true;
- K3TempFile* temp = new K3TempFile();
+ KTemporaryFile temp;
+ bool correct=temp.open();
- if( temp->status() != 0 ) {
+ if( correct ) {
emit error( i18n( "Could not open a temporary file." ) );
- temp->unlink();
- delete temp;
+ temp.remove();
return false;
}
- QTextStream* stream = temp->textStream();
+ QTextStream stream( &temp );
QStringList list;
- DiffHunkListConstIterator hunkIt = model->hunks()->begin();
- DiffHunkListConstIterator hEnd = model->hunks()->end();
+ DiffHunkListConstIterator hunkIt = model->hunks()->constBegin();
+ DiffHunkListConstIterator hEnd = model->hunks()->constEnd();
for( ; hunkIt != hEnd; ++hunkIt )
{
DiffHunk* hunk = *hunkIt;
- DifferenceListConstIterator diffIt = hunk->differences().begin();
- DifferenceListConstIterator dEnd = hunk->differences().end();
+ DifferenceListConstIterator diffIt = hunk->differences().constBegin();
+ DifferenceListConstIterator dEnd = hunk->differences().constEnd();
Difference* diff;
for( ; diffIt != dEnd; ++diffIt )
@@ -353,53 +323,77 @@
}
}
- // kDebug( 8101 ) << "Everything:"<< list.join( "\n" );
+ // kDebug(8101) << "Everything: " << endl << list.join( "\n" ) << endl;
if( list.count() > 0 )
- *stream << list.join( "" );
+ stream << list.join( "" );
- temp->close();
- if( temp->status() != 0 ) {
- emit error( i18n( "Could not write to the temporary file %1, deleting it.", temp->name() ) );
- temp->unlink();
- delete temp;
+ temp.close();
+ if( false/* || temp.status() != 0 */) {
+ emit error( i18n( "Could not write to the temporary file %1, deleting it.", temp.fileName() ) );
+ temp.remove();
return false;
}
bool result = false;
- if ( m_info.mode == Kompare::ComparingDirs )
+ // Make sure the destination directory exists, it is possible when using -N to not have the destination dir/file available
+ if ( m_info->mode == Kompare::ComparingDirs )
{
- QString destination = model->destinationPath() + model->destinationFile();
- kDebug(8101) << "Tempfilename :" << temp->name();
- kDebug(8101) << "DestinationURL :" << destination;
+ // Dont use destination which was used for creating the diff directly, use the original URL!!!
+ // FIXME!!! Wrong destination this way! Need to add the sub directory to the url!!!!
+ kDebug(8101) << "Tempfilename (save) : " << temp.fileName() << endl;
+ kDebug(8101) << "Model->path+file : " << model->destinationPath() << model->destinationFile() << endl;
+ kDebug(8101) << "info->localdest : " << m_info->localDestination << endl;
+ QString tmp = model->destinationPath() + model->destinationFile();
+ if ( tmp.startsWith( m_info->localDestination ) ) // It should, if not serious trouble...
+ tmp.remove( 0, m_info->localDestination.size() );
+ kDebug(8101) << "DestinationURL : " << m_info->destination << endl;
+ kDebug(8101) << "tmp : " << tmp << endl;
KIO::UDSEntry entry;
- if ( !KIO::NetAccess::stat( KUrl( destination ).toLocalFile(), entry, (QWidget*)parent() ) )
+ KUrl fullDestinationPath( m_info->destination );
+ fullDestinationPath.addPath( tmp );
+ kDebug(8101) << "fullDestinationPath : " << fullDestinationPath << endl;
+ if ( !KIO::NetAccess::stat( fullDestinationPath.directory(), entry, m_widgetForKIO ) )
{
- if ( !KIO::NetAccess::mkdir( KUrl( destination ).toLocalFile(), (QWidget*)parent() ) )
+ if ( !KIO::NetAccess::mkdir( fullDestinationPath.directory(), m_widgetForKIO ) )
{
- emit error( i18n( "Could not create destination directory %1.\nThe file has not been saved.", destination ) );
+ emit error( i18n( "Could not create destination directory %1.\nThe file has not been saved.", fullDestinationPath.directory() ) );
return false;
}
}
- result = KIO::NetAccess::upload( temp->name(), KUrl( destination ), (QWidget*)parent() );
+ result = KIO::NetAccess::upload( temp.fileName(), fullDestinationPath, m_widgetForKIO );
}
else
{
- kDebug(8101) << "Tempfilename :" << temp->name();
- kDebug(8101) << "DestinationURL :" << m_destination;
- result = KIO::NetAccess::upload( temp->name(), KUrl( m_destination ), (QWidget*)parent() );
+ kDebug(8101) << "Tempfilename : " << temp.fileName() << endl;
+ kDebug(8101) << "DestinationURL : " << m_info->destination << endl;
+ result = KIO::NetAccess::upload( temp.fileName(), m_info->destination, m_widgetForKIO );
+ kDebug(8101) << "true or false?" << result << endl;
}
if ( !result )
{
- emit error( i18n( "Could not upload the temporary file to the destination location %1. The temporary file is still available under: %2. You can manually copy it to the right place.", m_destination, temp->name() ) );
+ // FIXME: Wrong first argument given in case of comparing directories!
+ emit error( i18n( "Could not upload the temporary file to the destination location %1. The temporary file is still available under: %2. You can manually copy it to the right place.", m_info->destination.url(), temp.fileName() ) );
+ //Don't remove file when we delete temp and don't leak it.
+ temp.setAutoRemove(false);
}
else
{
- //model->slotSetModified( false );
- temp->unlink();
- delete temp;
+ temp.remove();
+ }
+
+ // If saving was fine set all differences to saved so we can start again with a clean slate
+ if ( result )
+ {
+ DifferenceListConstIterator diffIt = model->differences()->constBegin();
+ DifferenceListConstIterator endIt = model->differences()->constEnd();
+
+ for (; diffIt != endIt; ++diffIt )
+ {
+ (*diffIt)->setUnsaved( false );
+ }
}
return true;
@@ -407,7 +401,7 @@
bool KompareModelList::saveAll()
{
- if ( !m_models )
+ if ( modelCount() == 0 )
return false;
DiffModelListIterator it = m_models->begin();
@@ -417,18 +411,26 @@
if( !saveDestination( *it ) )
return false;
}
+
return true;
}
void KompareModelList::setEncoding( const QString& encoding )
{
m_encoding = encoding;
- kDebug(9500) << "Encoding :" << encoding;
- m_textCodec = KGlobal::charsets()->codecForName( encoding.toLatin1() );
- kDebug(9500) << "TextCodec:" << m_textCodec;
- if ( !m_textCodec )
+ if ( !encoding.compare( "default", Qt::CaseInsensitive ) )
+ {
m_textCodec = QTextCodec::codecForLocale();
- kDebug(9500) << "TextCodec:" << m_textCodec;
+ }
+ else
+ {
+ kDebug(8101) << "Encoding : " << encoding << endl;
+ m_textCodec = KGlobal::charsets()->codecForName( encoding.toLatin1() );
+ kDebug(8101) << "TextCodec: " << m_textCodec << endl;
+ if ( !m_textCodec )
+ m_textCodec = QTextCodec::codecForLocale();
+ }
+ kDebug(8101) << "TextCodec: " << m_textCodec << endl;
}
void KompareModelList::slotDiffProcessFinished( bool success )
@@ -442,17 +444,17 @@
}
else
{
- if ( m_info.mode != Kompare::ShowingDiff )
+ if ( m_info->mode != Kompare::ShowingDiff )
{
- kDebug(9500) << "Blend this crap please and do not gimme any conflicts...";
- blendOriginalIntoModelList( m_info.localSource );
+ kDebug(8101) << "Blend this crap please and do not give me any conflicts..." << endl;
+ blendOriginalIntoModelList( m_info->localSource );
}
updateModelListActions();
show();
}
emit status( Kompare::FinishedParsing );
}
- else if ( m_diffProcess->process()->exitStatus() == QProcess::NormalExit )
+ else if ( m_diffProcess->exitStatus() == 0 )
{
emit error( i18n( "The files are identical." ) );
}
@@ -461,14 +463,14 @@
emit error( m_diffProcess->stdErr() );
}
- delete m_diffProcess;
+ m_diffProcess->deleteLater();
m_diffProcess = 0;
}
void KompareModelList::slotDirectoryChanged( const QString& /*dir*/ )
{
// some debug output to see if watching works properly
- kDebug(8101) << "Yippie directories are being watched !!! :)";
+ kDebug(8101) << "Yippie directories are being watched !!! :)" << endl;
if ( m_diffProcess )
{
emit status( Kompare::ReRunningDiff );
@@ -479,7 +481,7 @@
void KompareModelList::slotFileChanged( const QString& /*file*/ )
{
// some debug output to see if watching works properly
- kDebug(8101) << "Yippie files are being watched !!! :)";
+ kDebug(8101) << "Yippie files are being watched !!! :)" << endl;
if ( m_diffProcess )
{
emit status( Kompare::ReRunningDiff );
@@ -493,7 +495,7 @@
QStringList list;
int pos = 0;
- unsigned int oldpos = 0;
+ int oldpos = 0;
// split that does not strip the split char
#ifdef QT_OS_MAC
const char split = '\r';
@@ -522,7 +524,7 @@
file.open( QIODevice::ReadOnly );
QTextStream stream( &file );
- kDebug(9500) << "Codec =" << m_textCodec;
+ kDebug(8101) << "Codec = " << m_textCodec << endl;
if ( !m_textCodec )
m_textCodec = QTextCodec::codecForLocale();
@@ -538,7 +540,7 @@
bool KompareModelList::openDiff( const QString& diffFile )
{
- kDebug(8101) << "Stupid :) Url =" << diffFile;
+ kDebug(8101) << "Stupid :) Url = " << diffFile << endl;
if ( diffFile.isEmpty() )
return false;
@@ -567,8 +569,8 @@
{
QString diff;
- DiffModelListConstIterator modelIt = m_models->begin();
- DiffModelListConstIterator mEnd = m_models->end();
+ DiffModelListConstIterator modelIt = m_models->constBegin();
+ DiffModelListConstIterator mEnd = m_models->constEnd();
for ( ; modelIt != mEnd; ++modelIt )
{
@@ -577,22 +579,23 @@
return diff;
}
-bool KompareModelList::saveDiff( const QString& url, const QString& directory, DiffSettings* diffSettings )
+bool KompareModelList::saveDiff( const QString& url, QString directory, DiffSettings* diffSettings )
{
- kDebug(9500) << "KompareModelList::saveDiff:";
+ kDebug(8101) << "KompareModelList::saveDiff: " << endl;
- m_diffTemp = new K3TempFile();
+ m_diffTemp = new KTemporaryFile();
m_diffURL = url;
+ bool opened=m_diffTemp->open();
- if( m_diffTemp->status() != 0 ) {
+ if( opened ) {
emit error( i18n( "Could not open a temporary file." ) );
- m_diffTemp->unlink();
+ m_diffTemp->remove();
delete m_diffTemp;
m_diffTemp = 0;
return false;
}
- m_diffProcess = new KompareProcess( diffSettings, Kompare::Custom, m_source, m_destination, directory );
+ m_diffProcess = new KompareProcess( diffSettings, Kompare::Custom, m_info->localSource, m_info->localDestination, directory );
m_diffProcess->setEncoding( m_encoding );
connect( m_diffProcess, SIGNAL(diffHasFinished( bool )),
@@ -600,33 +603,33 @@
emit status( Kompare::RunningDiff );
m_diffProcess->start();
- return m_diffProcess->process()->waitForStarted();
+ return true;
}
void KompareModelList::slotWriteDiffOutput( bool success )
{
- kDebug(8101) << "Success =" << success;
+ kDebug(8101) << "Success = " << success << endl;
if( success )
{
- QTextStream* stream = m_diffTemp->textStream();
+ QTextStream stream( m_diffTemp );
- *stream << m_diffProcess->diffOutput();
+ stream << m_diffProcess->diffOutput();
m_diffTemp->close();
- if( m_diffTemp->status() != 0 )
+ if( false /*|| m_diffTemp->status() != 0 */)
{
emit error( i18n( "Could not write to the temporary file." ) );
}
- KIO::NetAccess::upload( m_diffTemp->name(), KUrl( m_diffURL ), (QWidget*)parent() );
+ KIO::NetAccess::upload( m_diffTemp->fileName(), KUrl( m_diffURL ), m_widgetForKIO );
emit status( Kompare::FinishedWritingDiff );
}
m_diffURL.truncate( 0 );
- m_diffTemp->unlink();
+ m_diffTemp->remove();
delete m_diffTemp;
m_diffTemp = 0;
@@ -639,13 +642,13 @@
{
// This method will signal all the other objects about a change in selection,
// it will emit setSelection( const DiffModel*, const Difference* ) to all who are connected
- kDebug(8101) << "KompareModelList::slotSelectionChanged(" << model << "," << diff << ")";
-// kDebug(8101) << "Sender is :" << sender()->className();
-// kDebug(8101) << kBacktrace();
+ kDebug(8101) << "KompareModelList::slotSelectionChanged( " << model << ", " << diff << " )" << endl;
+ kDebug(8101) << "Sender is : " << sender()->metaObject()->className() << endl;
+// kDebug(8101) << kBacktrace() << endl;
m_selectedModel = const_cast(model);
- m_modelIndex = findItem( m_selectedModel, m_models );
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ m_modelIndex = m_models->indexOf( m_selectedModel );
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
m_selectedDifference = const_cast(diff);
m_selectedModel->setSelectedDifference( m_selectedDifference );
@@ -674,8 +677,8 @@
{
// This method will emit setSelection( const Difference* ) to whomever is listening
// when for instance in kompareview the selection has changed
- kDebug(8101) << "KompareModelList::slotSelectionChanged(" << diff << ")";
-// kDebug(8101) << "Sender is :" << sender()->className();
+ kDebug(8101) << "KompareModelList::slotSelectionChanged( " << diff << " )" << endl;
+ kDebug(8101) << "Sender is : " << sender()->metaObject()->className() << endl;
m_selectedDifference = const_cast(diff);
@@ -727,9 +730,9 @@
DiffModel* KompareModelList::firstModel()
{
- kDebug( 8101 ) << "KompareModelList::firstModel()";
+ kDebug(8101) << "KompareModelList::firstModel()" << endl;
m_modelIndex = 0;
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
m_selectedModel = m_models->first();
@@ -738,9 +741,9 @@
DiffModel* KompareModelList::lastModel()
{
- kDebug( 8101 ) << "KompareModelList::lastModel()";
+ kDebug(8101) << "KompareModelList::lastModel()" << endl;
m_modelIndex = m_models->count() - 1;
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
m_selectedModel = m_models->last();
@@ -749,17 +752,17 @@
DiffModel* KompareModelList::prevModel()
{
- kDebug( 8101 ) << "KompareModelList::prevModel()";
- if ( --m_modelIndex < m_models->count() )
+ kDebug(8101) << "KompareModelList::prevModel()" << endl;
+ if ( m_modelIndex > 0 && --m_modelIndex < m_models->count() )
{
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
m_selectedModel = (*m_models)[ m_modelIndex ];
}
else
{
m_selectedModel = 0;
m_modelIndex = 0;
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
}
return m_selectedModel;
@@ -767,17 +770,17 @@
DiffModel* KompareModelList::nextModel()
{
- kDebug( 8101 ) << "KompareModelList::nextModel()";
+ kDebug(8101) << "KompareModelList::nextModel()" << endl;
if ( ++m_modelIndex < m_models->count() )
{
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
m_selectedModel = (*m_models)[ m_modelIndex ];
}
else
{
m_selectedModel = 0;
m_modelIndex = 0;
- kDebug( 8101 ) << "m_modelIndex =" << m_modelIndex;
+ kDebug(8101) << "m_modelIndex = " << m_modelIndex << endl;
}
return m_selectedModel;
@@ -785,7 +788,7 @@
void KompareModelList::slotPreviousDifference()
{
- kDebug(8101) << "slotPreviousDifference called";
+ kDebug(8101) << "slotPreviousDifference called" << endl;
if ( ( m_selectedDifference = m_selectedModel->prevDifference() ) != 0 )
{
emit setSelection( m_selectedDifference );
@@ -794,7 +797,7 @@
return;
}
- kDebug(8101) << "**** no previous difference... ok lets find the previous model...";
+ kDebug(8101) << "**** no previous difference... ok lets find the previous model..." << endl;
if ( ( m_selectedModel = prevModel() ) != 0 )
{
@@ -807,7 +810,7 @@
}
- kDebug(8101) << "**** !!! No previous model, ok backup plan activated...";
+ kDebug(8101) << "**** !!! No previous model, ok backup plan activated..." << endl;
// Backup plan
m_selectedModel = firstModel();
@@ -820,7 +823,7 @@
void KompareModelList::slotNextDifference()
{
- kDebug(8101) << "slotNextDifference called";
+ kDebug(8101) << "slotNextDifference called" << endl;
if ( ( m_selectedDifference = m_selectedModel->nextDifference() ) != 0 )
{
emit setSelection( m_selectedDifference );
@@ -829,7 +832,7 @@
return;
}
- kDebug(8101) << "**** no next difference... ok lets find the next model...";
+ kDebug(8101) << "**** no next difference... ok lets find the next model..." << endl;
if ( ( m_selectedModel = nextModel() ) != 0 )
{
@@ -841,7 +844,7 @@
return;
}
- kDebug(8101) << "**** !!! No next model, ok backup plan activated...";
+ kDebug(8101) << "**** !!! No next model, ok backup plan activated..." << endl;
// Backup plan
m_selectedModel = lastModel();
@@ -866,29 +869,30 @@
int KompareModelList::parseDiffOutput( const QString& diff )
{
- kDebug(8101) << "KompareModelList::parseDiffOutput";
+ kDebug(8101) << "KompareModelList::parseDiffOutput" << endl;
+ emit diffString( diff );
QStringList diffLines = split( diff );
Parser* parser = new Parser( this );
m_models = parser->parse( diffLines );
- m_info.generator = parser->generator();
- m_info.format = parser->format();
+ m_info->generator = parser->generator();
+ m_info->format = parser->format();
delete parser;
if ( m_models )
{
m_selectedModel = firstModel();
- kDebug(8101) << "Ok there are differences...";
+ kDebug(8101) << "Ok there are differences..." << endl;
m_selectedDifference = m_selectedModel->firstDifference();
emit setStatusBarModelInfo( 0, 0, modelCount(), differenceCount(), 0);
}
else
{
// Wow trouble, no models, so no differences...
- kDebug(8101) << "Now i'll be damned, there should be models here !!!";
+ kDebug(8101) << "Now i'll be damned, there should be models here !!!" << endl;
return -1;
}
@@ -897,7 +901,7 @@
bool KompareModelList::blendOriginalIntoModelList( const QString& localURL )
{
- kDebug(9500) << "Hurrah we are blending...";
+ kDebug(8101) << "Hurrah we are blending..." << endl;
QFileInfo fi( localURL );
bool result = false;
@@ -907,45 +911,42 @@
if ( fi.isDir() )
{ // is a dir
- kDebug(9500) << "Blend Dir";
+ kDebug(8101) << "Blend Dir" << endl;
// QDir dir( localURL, QString(), QDir::Name|QDir::DirsFirst, QDir::TypeMask );
DiffModelListIterator modelIt = m_models->begin();
DiffModelListIterator mEnd = m_models->end();
for ( ; modelIt != mEnd; ++modelIt )
{
model = *modelIt;
- kDebug(8101) << "Model :" << model;
+ kDebug(8101) << "Model : " << model << endl;
QString filename = model->sourcePath() + model->sourceFile();
- if ( !filename.startsWith( localURL ) ) {
- KUrl u( localURL );
- u.addPath( filename );
- filename = u.toLocalFile();
- }
+ if ( !filename.startsWith( localURL ) )
+ filename.prepend( localURL );
QFileInfo fi2( filename );
if ( fi2.exists() )
{
- kDebug(8101) << "Reading from:" << filename;
+ kDebug(8101) << "Reading from: " << filename << endl;
fileContents = readFile( filename );
result = blendFile( model, fileContents );
}
else
{
- kDebug(8101) << "File" << filename << "does not exist !";
- kDebug(8101) << "Assume empty file !";
+ kDebug(8101) << "File " << filename << " does not exist !" << endl;
+ kDebug(8101) << "Assume empty file !" << endl;
fileContents.truncate( 0 );
result = blendFile( model, fileContents );
}
}
- kDebug(9500) << "End of Blend Dir";
+ kDebug(8101) << "End of Blend Dir" << endl;
}
else if ( fi.isFile() )
{ // is a file
- kDebug(9500) << "Blend File";
- kDebug(8101) << "Reading from:" << localURL;
+ kDebug(8101) << "Blend File" << endl;
+ kDebug(8101) << "Reading from: " << localURL << endl;
fileContents = readFile( localURL );
result = blendFile( (*m_models)[ 0 ], fileContents );
- kDebug(9500) << "End of Blend File";
+ kDebug(8101) << "End of Blend File" << endl;
}
return result;
@@ -955,7 +956,7 @@
{
if ( !model )
{
- kDebug(9500) << "**** model is null :(";
+ kDebug(8101) << "**** model is null :(" << endl;
return false;
}
@@ -963,13 +964,17 @@
int srcLineNo = 1, destLineNo = 1;
- QStringList lines = split( fileContents );
+ QStringList list = split( fileContents );
+ QLinkedList lines;
+ foreach (const QString &str, list) {
+ lines.append(str);
+ }
- QStringList::ConstIterator linesIt = lines.constBegin();
- QStringList::ConstIterator lEnd = lines.constEnd();
+ QLinkedList::ConstIterator linesIt = lines.begin();
+ QLinkedList::ConstIterator lEnd = lines.end();
DiffHunkList* hunks = model->hunks();
- kDebug(8101) << "Hunks in hunklist:" << hunks->count();
+ kDebug(8101) << "Hunks in hunklist: " << hunks->count() << endl;
DiffHunkListIterator hunkIt = hunks->begin();
DiffHunk* newHunk = 0;
@@ -988,7 +993,7 @@
{
newHunk = new DiffHunk( srcLineNo, destLineNo, "", DiffHunk::AddedByBlend );
- hunks->insert( hunkIt, newHunk );
+ hunkIt = ++hunks->insert( hunkIt, newHunk );
newDiff = new Difference( srcLineNo, destLineNo,
Difference::Unchanged );
@@ -1010,15 +1015,11 @@
for ( int i = 0; i < size; ++i )
{
- if( linesIt == lEnd ) {
- kDebug(9500) << "kompare error";
- return false;
- }
++linesIt;
}
srcLineNo += size;
- destLineNo += (*hunkIt)->destinationLineCount();
+ destLineNo += hunk->destinationLineCount();
}
if ( linesIt != lEnd )
@@ -1042,7 +1043,7 @@
DifferenceList hunkDiffList = (*hunkIt)->differences();
DifferenceListIterator diffIt = hunkDiffList.begin();
DifferenceListIterator dEnd = hunkDiffList.end();
- kDebug(9500) << "Number of differences in hunkDiffList =" << diffList.count();
+ kDebug(8101) << "Number of differences in hunkDiffList = " << diffList.count() << endl;
DifferenceListIterator tempIt;
Difference* diff;
@@ -1050,7 +1051,7 @@
for ( ; diffIt != dEnd; ++diffIt )
{
diff = *diffIt;
- kDebug(9500) << "*(Diff it) =" << diff;
+ kDebug(8101) << "*(Diff it) = " << diff << endl;
// Check if there are lines in the original file before the difference
// that are not yet in the diff. If so create new Unchanged diff
if ( srcLineNo < diff->sourceLineNumber() )
@@ -1060,7 +1061,7 @@
newHunk->add( newDiff );
while ( srcLineNo < diff->sourceLineNumber() && linesIt != lEnd )
{
-// kDebug(8101) << "SourceLine =" << srcLineNo << ":" << *linesIt;
+// kDebug(8101) << "SourceLine = " << srcLineNo << ": " << *linesIt << endl;
newDiff->addSourceLine( *linesIt );
newDiff->addDestinationLine( *linesIt );
srcLineNo++;
@@ -1072,20 +1073,20 @@
switch ( diff->type() )
{
case Difference::Unchanged:
- kDebug(8101) << "Unchanged";
+ kDebug(8101) << "Unchanged" << endl;
for ( int i = 0; i < diff->sourceLineCount(); i++ )
{
if ( linesIt != lEnd && *linesIt != diff->sourceLineAt( i )->string() )
{
- kDebug(8101) << "Conflict: SourceLine =" << srcLineNo << ":" << *linesIt;
- kDebug(8101) << "Conflict: DiffLine =" << diff->sourceLineNumber() + i << ":" << diff->sourceLineAt( i )->string();
+ kDebug(8101) << "Conflict: SourceLine = " << srcLineNo << ": " << *linesIt << endl;
+ kDebug(8101) << "Conflict: DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string() << endl;
// Do conflict resolution (well sort of)
diff->sourceLineAt( i )->setConflictString( *linesIt );
diff->setConflict( true );
}
-// kDebug(8101) << "SourceLine =" << srcLineNo << ":" << *linesIt;
-// kDebug(8101) << "DiffLine =" << diff->sourceLineNumber() + i << ":" << diff->sourceLineAt( i )->string();
+// kDebug(8101) << "SourceLine = " << srcLineNo << ": " << *linesIt << endl;
+// kDebug(8101) << "DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string() << endl;
srcLineNo++;
destLineNo++;
++linesIt;
@@ -1098,7 +1099,7 @@
break;
case Difference::Change:
- kDebug(8101) << "Change";
+ kDebug(8101) << "Change" << endl;
//QStringListConstIterator saveIt = linesIt;
@@ -1106,8 +1107,8 @@
{
if ( linesIt != lEnd && *linesIt != diff->sourceLineAt( i )->string() )
{
- kDebug(8101) << "Conflict: SourceLine =" << srcLineNo << ":" << *linesIt;
- kDebug(8101) << "Conflict: DiffLine =" << diff->sourceLineNumber() + i << ":" << diff->sourceLineAt( i )->string();
+ kDebug(8101) << "Conflict: SourceLine = " << srcLineNo << ": " << *linesIt << endl;
+ kDebug(8101) << "Conflict: DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string() << endl;
// Do conflict resolution (well sort of)
diff->sourceLineAt( i )->setConflictString( *linesIt );
@@ -1128,7 +1129,7 @@
break;
case Difference::Insert:
- kDebug(8101) << "Insert";
+ kDebug(8101) << "Insert" << endl;
destLineNo += diff->destinationLineCount();
tempIt = diffIt;
--diffIt;
@@ -1137,22 +1138,22 @@
newModel->addDiff( diff );
break;
case Difference::Delete:
- kDebug(8101) << "Delete";
- kDebug(8101) << "Number of lines in Delete:" << diff->sourceLineCount();
+ kDebug(8101) << "Delete" << endl;
+ kDebug(8101) << "Number of lines in Delete: " << diff->sourceLineCount() << endl;
for ( int i = 0; i < diff->sourceLineCount(); i++ )
{
if ( linesIt != lEnd && *linesIt != diff->sourceLineAt( i )->string() )
{
- kDebug(8101) << "Conflict: SourceLine =" << srcLineNo << ":" << *linesIt;
- kDebug(8101) << "Conflict: DiffLine =" << diff->sourceLineNumber() + i << ":" << diff->sourceLineAt( i )->string();
+ kDebug(8101) << "Conflict: SourceLine = " << srcLineNo << ": " << *linesIt << endl;
+ kDebug(8101) << "Conflict: DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string() << endl;
// Do conflict resolution (well sort of)
diff->sourceLineAt( i )->setConflictString( *linesIt );
diff->setConflict( true );
}
-// kDebug(8101) << "SourceLine =" << srcLineNo << ":" << *it;
-// kDebug(8101) << "DiffLine =" << diff->sourceLineNumber() + i << ":" << diff->sourceLineAt( i )->string();
+// kDebug(8101) << "SourceLine = " << srcLineNo << ": " << *it << endl;
+// kDebug(8101) << "DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string() << endl;
srcLineNo++;
++linesIt;
}
@@ -1164,7 +1165,7 @@
newModel->addDiff( diff );
break;
default:
- kDebug(8101) << "****, some diff type we do not know about ???";
+ kDebug(8101) << "****, some diff type we do not know about ???" << endl;
}
}
}
@@ -1174,10 +1175,10 @@
diffList = newModel->differences();
diff = diffList.first();
- kDebug(8101) << "Count =" << diffList.count();
+ kDebug(8101) << "Count = " << diffList.count() << endl;
for ( diff = diffList.first(); diff; diff = diffList.next() )
{
- kDebug(8101) << "sourcelinenumber =" << diff->sourceLineNumber();
+ kDebug(8101) << "sourcelinenumber = " << diff->sourceLineNumber() << endl;
}
*/
@@ -1190,7 +1191,7 @@
void KompareModelList::show()
{
- kDebug(9500) << "KompareModelList::Show Number of models =" << m_models->count();
+ kDebug(8101) << "KompareModelList::Show Number of models = " << m_models->count() << endl;
emit modelsChanged( m_models );
emit setSelection( m_selectedModel, m_selectedDifference );
}
@@ -1203,20 +1204,34 @@
emit modelsChanged( m_models );
}
+void KompareModelList::refresh()
+{
+ // FIXME: I can imagine blending also wants to be refreshed so make a switch case here
+ compare(m_info->mode);
+}
+
void KompareModelList::swap()
{
- QString source = m_source;
- QString destination = m_destination;
- if ( m_info.mode == Kompare::ComparingFiles )
- compareFiles( destination, source );
- else if ( m_info.mode == Kompare::ComparingDirs )
- compareDirs( destination, source );
+ //FIXME Not sure if any mode could be swapped
+ if ( m_info->mode == Kompare::ComparingFiles )
+ compare(m_info->mode);
+ else if ( m_info->mode == Kompare::ComparingDirs )
+ compare(m_info->mode);
}
-bool KompareModelList::isModified() const
+bool KompareModelList::hasUnsavedChanges() const
{
- if ( m_noOfModified > 0 )
- return true;
+ if ( modelCount() == 0 )
+ return false;
+
+ DiffModelListConstIterator modelIt = m_models->constBegin();
+ DiffModelListConstIterator endIt = m_models->constEnd();
+
+ for ( ; modelIt != endIt; ++modelIt )
+ {
+ if ( (*modelIt)->hasUnsavedChanges() )
+ return true;
+ }
return false;
}
@@ -1235,45 +1250,22 @@
return m_selectedModel ? m_selectedModel->appliedCount() : -1;
}
-void KompareModelList::slotSetModified( bool modified )
+void KompareModelList::slotKompareInfo( struct Kompare::Info* info )
{
- kDebug(8101) << "KompareModelList::slotSetModified(" << modified << ");";
- kDebug(8101) << "Before: m_noOfModified =" << m_noOfModified;
-
- // If selectedModel emits its signal setModified it does not set the model
- // internal m_modified bool yet, it only does that after the emit.
- if ( modified && !m_selectedModel->isModified() )
- m_noOfModified++;
- else if ( !modified && m_selectedModel->isModified() )
- m_noOfModified--;
-
- kDebug(8101) << "After : m_noOfModified =" << m_noOfModified;
-
- if ( m_noOfModified < 0 )
- {
- kDebug(8101) << "Wow something is ****ed up...";
- }
- else if ( m_noOfModified == 0 )
- {
- emit setModified( false );
- }
- else // > 0 :-)
- {
- emit setModified( true );
- }
+ m_info = info;
}
bool KompareModelList::setSelectedModel( DiffModel* model )
{
- kDebug(8101) << "KompareModelList::setSelectedModel(" << model << ")";
+ kDebug(8101) << "KompareModelList::setSelectedModel( " << model << " )" << endl;
if ( model != m_selectedModel )
{
- if ( findItem( model , m_models ) == -1 )
+ if ( !m_models->contains( model ) )
return false;
- kDebug(8101) << "m_selectedModel (was) =" << m_selectedModel;
- m_modelIndex = findItem( model , m_models );
- kDebug(8101) << "m_selectedModel (is) =" << m_selectedModel;
+ kDebug(8101) << "m_selectedModel (was) = " << m_selectedModel << endl;
+ m_modelIndex = m_models->indexOf( model );
+ kDebug(8101) << "m_selectedModel (is) = " << m_selectedModel << endl;
m_selectedModel = model;
}
@@ -1283,123 +1275,124 @@
}
void KompareModelList::updateModelListActions()
-{/*
- if ( m_models && m_selectedModel && m_selectedDifference )
- {
- if ( ( ( KomparePart* )parent() )->isReadWrite() )
- {
- if ( m_selectedModel->appliedCount() != m_selectedModel->differenceCount() )
- m_applyAll->setEnabled( true );
- else
- m_applyAll->setEnabled( false );
-
- if ( m_selectedModel->appliedCount() != 0 )
- m_unapplyAll->setEnabled( true );
- else
- m_unapplyAll->setEnabled( false );
-
- m_applyDifference->setEnabled( true );
- m_unApplyDifference->setEnabled( true );
- m_save->setEnabled( m_selectedModel->isModified() );
- }
- else
- {
- m_applyDifference->setEnabled ( false );
- m_unApplyDifference->setEnabled( false );
- m_applyAll->setEnabled ( false );
- m_unapplyAll->setEnabled ( false );
- m_save->setEnabled ( false );
- }
-
- m_previousFile->setEnabled ( hasPrevModel() );
- m_nextFile->setEnabled ( hasNextModel() );
- m_previousDifference->setEnabled( hasPrevDiff() );
- m_nextDifference->setEnabled ( hasNextDiff() );
- }
- else
- {
- m_applyDifference->setEnabled ( false );
- m_unApplyDifference->setEnabled ( false );
- m_applyAll->setEnabled ( false );
- m_unapplyAll->setEnabled ( false );
-
- m_previousFile->setEnabled ( false );
- m_nextFile->setEnabled ( false );
- m_previousDifference->setEnabled( false );
- m_nextDifference->setEnabled ( false );
- m_save->setEnabled ( false );
- }*/
+{
+// if ( m_models && m_selectedModel && m_selectedDifference )
+// {
+// // ARGH!!!! Casts are evil!!!
+// if ( false /*( ( KomparePart* )parent() )->isReadWrite()*/ )
+// {
+// if ( m_selectedModel->appliedCount() != m_selectedModel->differenceCount() )
+// m_applyAll->setEnabled( true );
+// else
+// m_applyAll->setEnabled( false );
+//
+// if ( m_selectedModel->appliedCount() != 0 )
+// m_unapplyAll->setEnabled( true );
+// else
+// m_unapplyAll->setEnabled( false );
+//
+// m_applyDifference->setEnabled( m_selectedDifference->applied() == false );
+// m_unApplyDifference->setEnabled( m_selectedDifference->applied() == true );
+// m_save->setEnabled( m_selectedModel->hasUnsavedChanges() );
+// }
+// else
+// {
+// m_applyDifference->setEnabled ( false );
+// m_unApplyDifference->setEnabled( false );
+// m_applyAll->setEnabled ( false );
+// m_unapplyAll->setEnabled ( false );
+// m_save->setEnabled ( false );
+// }
+//
+// m_previousFile->setEnabled ( hasPrevModel() );
+// m_nextFile->setEnabled ( hasNextModel() );
+// m_previousDifference->setEnabled( hasPrevDiff() );
+// m_nextDifference->setEnabled ( hasNextDiff() );
+// }
+// else
+// {
+// m_applyDifference->setEnabled ( false );
+// m_unApplyDifference->setEnabled ( false );
+// m_applyAll->setEnabled ( false );
+// m_unapplyAll->setEnabled ( false );
+//
+// m_previousFile->setEnabled ( false );
+// m_nextFile->setEnabled ( false );
+// m_previousDifference->setEnabled( false );
+// m_nextDifference->setEnabled ( false );
+// m_save->setEnabled ( false );
+// }
}
bool KompareModelList::hasPrevModel() const
{
- kDebug(8101) << "KompareModelList::hasPrevModel()";
+ kDebug(8101) << "KompareModelList::hasPrevModel()" << endl;
if ( m_modelIndex > 0 )
{
-// kDebug(8101) << "has prev model";
+// kDebug(8101) << "has prev model" << endl;
return true;
}
-// kDebug(8101) << "doesn't have a prev model, this is the first one...";
+// kDebug(8101) << "doesn't have a prev model, this is the first one..." << endl;
return false;
}
bool KompareModelList::hasNextModel() const
{
- kDebug(8101) << "KompareModelList::hasNextModel()";
+ kDebug(8101) << "KompareModelList::hasNextModel()" << endl;
- if ( ( unsigned int )m_modelIndex < ( m_models->count() - 1 ) )
+ if ( m_modelIndex < ( m_models->count() - 1 ) )
{
-// kDebug(8101) << "has next model";
+// kDebug(8101) << "has next model" << endl;
return true;
}
-// kDebug(8101) << "doesn't have a next model, this is the last one...";
+// kDebug(8101) << "doesn't have a next model, this is the last one..." << endl;
return false;
}
bool KompareModelList::hasPrevDiff() const
{
-// kDebug(8101) << "KompareModelList::hasPrevDiff()";
+// kDebug(8101) << "KompareModelList::hasPrevDiff()" << endl;
int index = m_selectedModel->diffIndex();
if ( index > 0 )
{
-// kDebug(8101) << "has prev difference in same model";
+// kDebug(8101) << "has prev difference in same model" << endl;
return true;
}
if ( hasPrevModel() )
{
-// kDebug(8101) << "has prev difference but in prev model";
+// kDebug(8101) << "has prev difference but in prev model" << endl;
return true;
}
-// kDebug(8101) << "doesn't have a prev difference, not even in the previous model because there is no previous model";
+// kDebug(8101) << "doesn't have a prev difference, not even in the previous model because there is no previous model" << endl;
return false;
}
bool KompareModelList::hasNextDiff() const
{
-// kDebug(8101) << "KompareModelList::hasNextDiff()";
+// kDebug(8101) << "KompareModelList::hasNextDiff()" << endl;
int index = m_selectedModel->diffIndex();
if ( index < ( m_selectedModel->differenceCount() - 1 ) )
{
-// kDebug(8101) << "has next difference in same model";
+// kDebug(8101) << "has next difference in same model" << endl;
return true;
}
if ( hasNextModel() )
{
-// kDebug(8101) << "has next difference but in next model";
+// kDebug(8101) << "has next difference but in next model" << endl;
return true;
}
-// kDebug(8101) << "doesn't have a next difference, not even in next model because there is no next model";
+// kDebug(8101) << "doesn't have a next difference, not even in next model because there is no next model" << endl;
return false;
}
diff -Nru kdevplatform-0.9.98/plugins/patchreview/libdiff2/komparemodellist.h kdevplatform-1.0.1/plugins/patchreview/libdiff2/komparemodellist.h
--- kdevplatform-0.9.98/plugins/patchreview/libdiff2/komparemodellist.h 2009-08-30 21:28:44.000000000 +0100
+++ kdevplatform-1.0.1/plugins/patchreview/libdiff2/komparemodellist.h 2010-07-17 19:58:27.000000000 +0100
@@ -1,9 +1,10 @@
/***************************************************************************
- komparemodellist.h - description
- -------------------
+ komparemodellist.h
+ -------------------
begin : Tue Jun 26 2001
- copyright : (C) 2001-2003 Otto Bruggeman
- copyright : (C) 2001-2003 John Firebaugh
+ Copyright 2001-2003 John Firebaugh
+ Copyright 2001-2005,2009 Otto Bruggeman