[SCM] ktp-send-file packaging branch, master, updated. debian/15.12.1-2-216-g8f07cdf

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:14:15 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-send-file.git;a=commitdiff;h=494d801

The following commit has been merged in the master branch:
commit 494d8014169e0a2429f0ad480e78a6a63297964d
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Mon Oct 31 19:59:43 2011 +0100

    Create preview for all file types, not only images. Also some small UI changes.
    
    Reviewed-by: Daniele E. Domenichelli
    REVIEW: 103002
---
 mainwindow.cpp | 22 +++++++++++++++++++++-
 mainwindow.h   |  4 ++--
 mainwindow.ui  | 33 +++++++++++++++++++++++----------
 3 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/mainwindow.cpp b/mainwindow.cpp
index 64b41e1..31d28e9 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -29,6 +29,7 @@
 #include <KMimeType>
 #include <KDebug>
 #include <KMessageBox>
+#include <KDE/KIO/PreviewJob>
 
 #include <QAbstractItemDelegate>
 #include <QPainter>
@@ -96,6 +97,7 @@ void ContactGridDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
 
 QSize ContactGridDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
 {
+    Q_UNUSED(index);
     int textHeight = option.fontMetrics.height()*2;
     return QSize(84, 80 + textHeight + 3);
 }
@@ -112,9 +114,18 @@ MainWindow::MainWindow(const KUrl &url, QWidget *parent) :
 
     kDebug() << KApplication::arguments();
 
-    ui->filePreview->showPreview(url);
     ui->fileNameLabel->setText(url.fileName());
 
+    KFileItem file(KFileItem::Unknown, KFileItem::Unknown, url);
+    KIO::PreviewJob* job = KIO::filePreview(KFileItemList() << file, QSize(280, 280), &KIO::PreviewJob::availablePlugins());
+    job->setOverlayIconAlpha(0);
+    job->setScaleType(KIO::PreviewJob::Unscaled);
+    connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)),
+            this, SLOT(onPreviewLoaded(KFileItem,QPixmap)));
+    connect(job, SIGNAL(failed(KFileItem)),
+            this, SLOT(onPreviewFailed(KFileItem)));
+
+
     Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
                                                                        Tp::Features() << Tp::Account::FeatureCore
                                                                        << Tp::Account::FeatureAvatar
@@ -217,4 +228,13 @@ void MainWindow::slotFileTransferFinished(Tp::PendingOperation* op)
     }
 }
 
+void MainWindow::onPreviewLoaded(const KFileItem& item, const QPixmap& preview)
+{
+    Q_UNUSED(item);
+    ui->filePreview->setPixmap(preview);
+}
 
+void MainWindow::onPreviewFailed(const KFileItem& item)
+{
+    kWarning() << "Loading thumb failed" << item.name();
+}
diff --git a/mainwindow.h b/mainwindow.h
index 4c40102..35250dc 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -27,7 +27,6 @@
 
 #include <TelepathyQt4/AccountManager>
 
-
 namespace Ui {
     class MainWindow;
 }
@@ -46,7 +45,8 @@ public:
 private slots:
     void onAccountManagerReady();
     void onDialogAccepted();
-
+    void onPreviewLoaded(const KFileItem &item, const QPixmap &preview);
+    void onPreviewFailed(const KFileItem &item);
     void slotFileTransferFinished(Tp::PendingOperation *op);
 
 private:
diff --git a/mainwindow.ui b/mainwindow.ui
index d99ce3b..0dc57de 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -54,7 +54,20 @@
         </spacer>
        </item>
        <item>
-        <widget class="KImageFilePreview" name="filePreview"/>
+        <widget class="QLabel" name="filePreview">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>280</height>
+          </size>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
        </item>
        <item>
         <widget class="QLabel" name="fileNameLabel">
@@ -82,6 +95,8 @@
       </layout>
      </item>
      <item>
+     <layout class="QVBoxLayout" name="verticalLayout2">
+     <item>
       <widget class="QListView" name="listView">
        <property name="minimumSize">
         <size>
@@ -89,6 +104,12 @@
          <height>0</height>
         </size>
        </property>
+       <property name="sizeIncrement">
+        <size>
+         <width>80</width>
+         <height>0</height>
+        </size>
+       </property>
        <property name="baseSize">
         <size>
          <width>260</width>
@@ -115,8 +136,7 @@
        </property>
       </widget>
      </item>
-     <item>
-      <layout class="QVBoxLayout" name="verticalLayout_2"/>
+     </layout>
      </item>
     </layout>
    </item>
@@ -129,13 +149,6 @@
    </item>
   </layout>
  </widget>
- <customwidgets>
-  <customwidget>
-   <class>KImageFilePreview</class>
-   <extends>QWidget</extends>
-   <header>kimagefilepreview.h</header>
-  </customwidget>
- </customwidgets>
  <resources/>
  <connections/>
 </ui>

-- 
ktp-send-file packaging



More information about the pkg-kde-commits mailing list