~ubuntu-branches/ubuntu/trusty/kdeplasma-addons/trusty

« back to all changes in this revision

Viewing changes to debian/patches/kubuntu_05_comic_prefetch.diff

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac, Philip Muškovac, Felix Geyer
  • Date: 2011-06-07 00:52:20 UTC
  • mfrom: (0.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110607005220-vvxuceku1xegr73s
Tags: 4:4.6.3-1ubuntu1
[ Philip Muškovac ]
* Merge from debian. Remaining changes: 
  - Keep our patch
  - Add debian/xinput folder
  - Build plasma-widget-kdeobservatory, plasma-widget-kimpanel,
    plasma-widget-kimpanel-backend-ibus
  - plasma-wallpapers-addons depends on plasma-dataengines-workspace,
    kdewallpapers, kdebase-workspace-wallpapers
  - Add plasma-widget-kimpanel-backend-ibus.{install, postinst, prerm}
  - Don't install kimpanel in plasma-widget-addons
  - Build against libboost1.46-dev
  - plasma-dataengines-addons replaces kdeplasma-addons (<< 4:4.4.60) and
    plasma-widgets-addons (<< 4:4.4.60)
  - plasma-widgets-addons suggests plasma-widget-lancelot instead of
    recommends
  - plasma-widgets-addons Breaks/Replaces plasma-widget-system-status
  - Build-depend on shared-mime-info and libglib2.0-dev
* Update Vcs- links as the branch is now owned by kubuntu-packagers

[ Felix Geyer ]
* Add python to plasma-widget-kimpanel-backend-ibus dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Matthias Fuchs <mat69@gmx.net>
2
 
Date: Thu, 07 Apr 2011 13:32:26 +0000
3
 
Subject: Fixes prefetching. Now constant useage of the comic applet does not lead to high memory usage.
4
 
X-Git-Url: http://quickgit.kde.org/?p=kdeplasma-addons.git&amp;a=commitdiff&amp;h=4ab9e40e1e3484a4adf059164c91e06d1f5b6b76
5
 
---
6
 
Fixes prefetching. Now constant useage of the comic applet does not lead to high memory usage.
7
 
REVIEW:101046
8
 
---
9
 
 
10
 
 
11
 
Index: kdeplasma-addons-4.6.2/applets/comic/comic.cpp
12
 
===================================================================
13
 
--- kdeplasma-addons-4.6.2.orig/applets/comic/comic.cpp 2011-04-10 10:40:19.520167015 +0200
14
 
+++ kdeplasma-addons-4.6.2/applets/comic/comic.cpp      2011-04-10 10:40:24.340167016 +0200
15
 
@@ -325,16 +325,26 @@
16
 
     }
17
 
 }
18
 
 
19
 
-void ComicApplet::dataUpdated( const QString&, const Plasma::DataEngine::Data &data )
20
 
+void ComicApplet::dataUpdated( const QString &source, const Plasma::DataEngine::Data &data )
21
 
 {
22
 
+    //disconnect prefetched comic strips
23
 
+    if ( source != mOldSource ) {
24
 
+        mEngine->disconnectSource( source, this );
25
 
+        return;
26
 
+    }
27
 
+
28
 
     setBusy( false );
29
 
     setConfigurationRequired( false );
30
 
     slotStartTimer();
31
 
 
32
 
     //there was an error, display information as image
33
 
-    if ( data[ "Error" ].toBool() ) {
34
 
-        if ( !mShowErrorPicture && !data[ "Previous identifier suffix" ].toString().isEmpty() ) {
35
 
-            updateComic( data[ "Previous identifier suffix" ].toString() );
36
 
+    const bool hasError = data[ "Error" ].toBool();
37
 
+    const bool errorAutoFixable = data[ "Error automatically fixable" ].toBool();
38
 
+    if ( hasError ) {
39
 
+        const QString previousIdentifierSuffix = data[ "Previous identifier suffix" ].toString();
40
 
+        if ( !mShowErrorPicture && !previousIdentifierSuffix.isEmpty() ) {
41
 
+            mEngine->disconnectSource( source, this );
42
 
+            updateComic( previousIdentifierSuffix );
43
 
             return;
44
 
         }
45
 
         QPixmap errorPic( 500, 400 );
46
 
@@ -420,6 +430,11 @@
47
 
     mLabelUrl->setText( mWebsiteUrl.host() );
48
 
     mImageWidget->setScaled( !mScaleComic );
49
 
 
50
 
+    //disconnect if there is either no error, or an error that can not be fixed automatically 
51
 
+    if ( !errorAutoFixable ) {
52
 
+        mEngine->disconnectSource( source, this );
53
 
+    }
54
 
+
55
 
     setTabBarVisible( mShowTabBar && mUseTabs );
56
 
     mLabelTop->setVisible( ( mShowComicAuthor || mShowComicTitle ) && !mLabelTop->text().isEmpty() );
57
 
     mLabelId->setVisible( mShowComicIdentifier && !mLabelId->text().isEmpty() );
58
 
@@ -449,11 +464,14 @@
59
 
 
60
 
     //prefetch the previous and following comic for faster navigation
61
 
     if ( !mNextIdentifierSuffix.isEmpty() ) {
62
 
-        mEngine->query( mComicIdentifier + ':' + mNextIdentifierSuffix );
63
 
+        const QString prefetch = mComicIdentifier + ':' + mNextIdentifierSuffix;
64
 
+        mEngine->connectSource( prefetch, this );
65
 
+        mEngine->query( prefetch );
66
 
     }
67
 
-
68
 
     if ( !mPreviousIdentifierSuffix.isEmpty() ) {
69
 
-        mEngine->query( mComicIdentifier + ':' + mPreviousIdentifierSuffix );
70
 
+        const QString prefetch = mComicIdentifier + ':' + mPreviousIdentifierSuffix;
71
 
+        mEngine->connectSource( prefetch, this );
72
 
+        mEngine->query( prefetch );
73
 
     }
74
 
 }
75
 
 
76
 
@@ -833,6 +851,7 @@
77
 
 
78
 
     setConfigurationRequired( mComicIdentifier.isEmpty() );
79
 
     if ( !mComicIdentifier.isEmpty() && mEngine && mEngine->isValid() ) {
80
 
+
81
 
         setBusy( true );
82
 
         const QString identifier = mComicIdentifier + ':' + identifierSuffix;
83
 
 
84
 
Index: kdeplasma-addons-4.6.2/dataengines/comic/comic.cpp
85
 
===================================================================
86
 
--- kdeplasma-addons-4.6.2.orig/dataengines/comic/comic.cpp     2011-04-10 10:40:19.530167015 +0200
87
 
+++ kdeplasma-addons-4.6.2/dataengines/comic/comic.cpp  2011-04-10 10:40:24.340167016 +0200
88
 
@@ -121,6 +121,7 @@
89
 
         if ( status != Solid::Networking::Connected && status != Solid::Networking::Unknown ) {
90
 
             mIdentifierError = identifier;
91
 
             setData( identifier, QLatin1String( "Error" ), true );
92
 
+            setData( identifier, QLatin1String( "Error automatically fixable" ), true );
93
 
             setData( identifier, QLatin1String( "Identifier" ), identifier );
94
 
             setData( identifier, QLatin1String( "Previous identifier suffix" ), lastCachedIdentifier( identifier ) );
95
 
             kWarning() << "No connection.";