backport 2 more critical fixes

This commit is contained in:
Lukas Tinkl 2008-10-15 12:26:02 +00:00
parent b2df829fb8
commit 41b1ad8ea2
3 changed files with 176 additions and 1 deletions

View File

@ -0,0 +1,111 @@
Index: kio/kio/kdirlister.h
===================================================================
--- kio/kio/kdirlister.h (revision 871258)
+++ kio/kio/kdirlister.h (revision 871259)
@@ -427,6 +427,18 @@
KFileItemList itemsForDir( const KUrl& dir,
WhichItems which = FilteredItems ) const;
+ /**
+ * Return the KFileItem for the given URL, if we listed it recently
+ * and it's still in the cache - which is always the case if a directory
+ * view is currently showing this item. If not, then it might be in the
+ * cache, or it might not, in which case you get a null KFileItem.
+ * If you really need a KFileItem for this URL in all cases, then use
+ * KIO::stat() instead.
+ *
+ * @since 4.2
+ */
+ static KFileItem cachedItemForUrl(const KUrl& url);
+
Q_SIGNALS:
/**
@@ -511,7 +523,7 @@
*
* @param _fileItem the fileItem to delete
*/
- void deleteItem( const KFileItem &_fileItem ); // KDE5: remove, and port to deleteItems
+ void deleteItem( const KFileItem &_fileItem ); // KDE5: remove, and port to itemsDeleted
/**
* Signal that items have been deleted
Index: kio/kio/kdirlister.cpp
===================================================================
--- kio/kio/kdirlister.cpp (revision 871258)
+++ kio/kio/kdirlister.cpp (revision 871259)
@@ -717,7 +717,7 @@
// Maybe _u is a directory itself? (see KDirModelTest::testChmodDirectory)
DirItem* dirItem = dirItemForUrl(url);
- if (dirItem && dirItem->rootItem.url() == url) {
+ if (dirItem && !dirItem->rootItem.isNull() && dirItem->rootItem.url() == url) {
// If lister is set, check that it contains this dir
if (!lister || lister->d->lstDirs.contains(url))
return &dirItem->rootItem;
@@ -1011,7 +1011,15 @@
if ( name == "." )
{
Q_ASSERT( dir->rootItem.isNull() );
- dir->rootItem = KFileItem( *it, url, delayedMimeTypes, true );
+ // Try to reuse an existing KFileItem (if we listed the parent dir)
+ // rather than creating a new one. There are many reasons:
+ // 1) renames and permission changes to the item would have to emit the signals
+ // twice, otherwise, so that both views manage to recognize the item.
+ // 2) with kio_ftp we can only know that something is a symlink when
+ // listing the parent, so prefer that item, which has more info.
+ dir->rootItem = itemForUrl(url);
+ if (dir->rootItem.isNull())
+ dir->rootItem = KFileItem( *it, url, delayedMimeTypes, true );
foreach ( KDirLister *kdl, dirData.listersCurrentlyListing )
if ( kdl->d->rootFileItem.isNull() && kdl->d->url == url )
@@ -2515,5 +2523,10 @@
}
}
+KFileItem KDirLister::cachedItemForUrl(const KUrl& url)
+{
+ return kDirListerCache->itemForUrl(url);
+}
+
#include "kdirlister.moc"
#include "kdirlister_p.moc"
Index: kio/kio/deletejob.cpp
===================================================================
--- kio/kio/deletejob.cpp (revision 871258)
+++ kio/kio/deletejob.cpp (revision 871259)
@@ -21,6 +21,7 @@
#include "deletejob.h"
+#include "kdirlister.h"
#include "kmimetype.h"
#include "scheduler.h"
#include "kdirwatch.h"
@@ -218,6 +219,17 @@
// Stat it
state = DELETEJOB_STATE_STATING;
+ // Fast path for KFileItems in directory views
+ while(m_currentStat != m_srcList.end()) {
+ m_currentURL = (*m_currentStat);
+ KFileItem cachedItem = KDirLister::cachedItemForUrl(m_currentURL);
+ if (cachedItem.isNull())
+ break;
+ //kDebug(7007) << "Found cached info about" << m_currentURL << "isDir=" << cachedItem.isDir() << "isLink=" << cachedItem.isLink();
+ currentSourceStated(cachedItem.isDir(), cachedItem.isLink());
+ ++m_currentStat;
+ }
+
// Hook for unit test to disable the fast path.
extern bool kio_resolve_local_urls; // from copyjob.cpp, abused here to save a symbol.
if (!kio_resolve_local_urls) {
@@ -288,6 +300,7 @@
}
} else
{ // if remote - or if unlink() failed (we'll use the job's error handling in that case)
+ //kDebug(7007) << "calling file_delete on" << *it;
job = KIO::file_delete( *it, KIO::HideProgressInfo );
Scheduler::scheduleJob(job);
m_currentURL=(*it);

View File

@ -0,0 +1,55 @@
Index: kdeui/widgets/kmainwindow_p.h
===================================================================
--- kdeui/widgets/kmainwindow_p.h (revision 871464)
+++ kdeui/widgets/kmainwindow_p.h (revision 871465)
@@ -44,6 +44,7 @@
bool settingsDirty:1;
bool autoSaveWindowSize:1;
bool care_about_geometry:1;
+ bool sizeApplied:1;
bool shuttingDown:1;
KConfigGroup autoSaveGroup;
QTimer* settingsTimer;
Index: kdeui/widgets/kmainwindow.cpp
===================================================================
--- kdeui/widgets/kmainwindow.cpp (revision 871464)
+++ kdeui/widgets/kmainwindow.cpp (revision 871465)
@@ -284,6 +284,8 @@
dockResizeListener = new DockResizeListener(_q);
letDirtySettings = true;
+
+ sizeApplied = false;
}
static bool endsWithHashNumber( const QString& s )
@@ -677,6 +679,8 @@
bool KMainWindow::readPropertiesInternal( KConfig *config, int number )
{
+ K_D(KMainWindow);
+
if ( number == 1 )
readGlobalProperties( config );
@@ -691,6 +695,8 @@
if ( cg.hasKey(QLatin1String("ObjectName" )) )
setObjectName( cg.readEntry("ObjectName").toLatin1()); // latin1 is right here
+ d->sizeApplied = false; // since we are changing config file, reload the size of the window
+ // if necessary. Do it before the call to applyMainWindowSettings.
applyMainWindowSettings(cg); // Menubar, statusbar and toolbar settings.
s.setNum(number);
@@ -708,7 +714,10 @@
d->letDirtySettings = false;
- restoreWindowSize(cg);
+ if (!d->sizeApplied) {
+ restoreWindowSize(cg);
+ d->sizeApplied = true;
+ }
QStatusBar* sb = internalStatusBar(this);
if (sb) {

View File

@ -2,7 +2,7 @@
Summary: K Desktop Environment 4 - Libraries
Version: 4.1.2
Release: 4%{?dist}
Release: 5%{?dist}
%if 0%{?fedora} > 8
Name: kdelibs
@ -80,6 +80,8 @@ Patch20: kdelibs-4.1.1-cmake.patch
## upstream patches
Patch100: kdelibs-4.1.2-googlemaps.patch
Patch101: kdelibs-4.1.2-kde#171870-kded-crash.patch
Patch102: kdelibs-4.1.3-kde#172042-windowsize.patch
Patch103: kdelibs-4.1.3-kde#109181-kiodelete.patch
BuildRequires: qt4-devel >= 4.4.0
Requires: qt4 >= %{_qt4_version}
@ -207,6 +209,8 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
## upstream patches
%patch100 -p0 -b .googlemaps
%patch101 -p0 -b .kde#171870-kded-crash
%patch102 -p0 -b .kde#172042-windowsize
%patch103 -p0 -b .kde#109181-kiodelete
%build
@ -367,6 +371,11 @@ rm -rf %{buildroot}
%changelog
* Wed Oct 15 2008 Lukáš Tinkl <ltinkl@redhat.com> 4.1.2-5
- backport fix for faulty window resizing (kdebug:172042)
- backport fix for Konqueror deleting symlinks on directories
recursively (kdebug:109181)
* Mon Oct 13 2008 Than Ngo <than@redhat.com> 4.1.2-4
- backport patch to fix crash kded startup crash