[SCM] ktp-send-file packaging branch, upstream, updated. upstream/0.8.80-2-g8db5400
Maximiliano Curia
maxy at moszumanska.debian.org
Sun Jun 14 16:29:05 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-send-file.git;a=commitdiff;h=bede11f
The following commit has been merged in the upstream branch:
commit bede11fa4869bf3603d73d0f6aaf33c32d0447ae
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date: Mon May 18 15:49:39 2015 +0200
Imported Upstream version 15.04.1
---
.gitignore | 8 ++++++++
.reviewboardrc | 2 ++
CMakeLists.txt | 65 ++++++++++++++++++++--------------------------------------
main.cpp | 54 ++++++++++++++++++++++--------------------------
mainwindow.cpp | 38 +++++++++++++++-------------------
mainwindow.h | 6 ++----
6 files changed, 75 insertions(+), 98 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cb04c32
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*.directory
+*~
+.*.sw[p,o]
+/build
+tags
+.swp.*
+.kdev4/
+*.kdev4
diff --git a/.reviewboardrc b/.reviewboardrc
new file mode 100644
index 0000000..e0f7336
--- /dev/null
+++ b/.reviewboardrc
@@ -0,0 +1,2 @@
+REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
+REPOSITORY = 'git://anongit.kde.org/ktp-send-file'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9637819..4baf223 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,64 +1,43 @@
project(ktp-send-file)
-set (KTP_SEND_FILE_VERSION "0.8.80")
+cmake_minimum_required(VERSION 2.8.12)
-set (CMAKE_MODULE_PATH
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
- ${CMAKE_MODULE_PATH}
-)
-cmake_policy(SET CMP0002 OLD)
+set (KTP_SEND_FILE_VERSION "15.04.1")
-set(KDE_MIN_VERSION "4.7.0")
set(IS_KTP_INTERNAL_MODULE TRUE)
-find_package(KDE4 REQUIRED)
-find_package(TelepathyQt4 0.8.9 REQUIRED)
-find_package(KTp REQUIRED)
-include(KDE4Defaults)
-include(MacroLibrary)
-
-# Add the compiler flags
-add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
-include_directories(
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_BINARY_DIR}
- ${KDE4_INCLUDES}
- ${TELEPATHY_QT4_INCLUDE_DIR}
- ${KTP_INCLUDE_DIR}
-)
+find_package(ECM 1.3.0 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
-# Insert your sources here
-set(KTP_SEND_FILE_SRCS
- mainwindow.cpp
- main.cpp
-)
+find_package(Qt5 5.0 REQUIRED COMPONENTS Widgets)
+find_package(KF5 5.0 REQUIRED COMPONENTS KCMUtils KIO IconThemes I18n)
+find_package(KTp REQUIRED)
-set(KTP_SEND_FILE_UI
- mainwindow.ui)
+include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(FeatureSummary)
configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
-kde4_add_ui_files(KTP_SEND_FILE_SRCS ${KTP_SEND_FILE_UI})
+qt5_wrap_ui(KTP_SEND_FILE_SRCS mainwindow.ui)
# Create the plasmoid
-kde4_add_executable(ktp-send-file ${KTP_SEND_FILE_SRCS})
+add_executable(ktp-send-file mainwindow.cpp main.cpp ${KTP_SEND_FILE_SRCS})
# Link against the needed libraries
target_link_libraries(ktp-send-file
- ${TELEPATHY_QT4_LIBRARIES}
- ${KTP_LIBRARIES}
- ${KTP_MODELS_LIBRARIES}
- ${KTP_WIDGETS_LIBRARIES}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KIO_LIBS}
+ KTp::CommonInternals
+ KTp::Widgets
+ KTp::Models
+ Qt5::Widgets
+ KF5::CoreAddons
+ KF5::I18n
+ KF5::KIOWidgets
+ KF5::IconThemes
)
install(TARGETS ktp-send-file ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ktp-send-file.desktop DESTINATION ${SERVICES_INSTALL_DIR}/ServiceMenus)
-macro_display_feature_log()
-
-
-find_package(Msgfmt REQUIRED)
-find_package(Gettext REQUIRED)
-add_subdirectory( po )
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/main.cpp b/main.cpp
index 8b16af2..cf3a407 100644
--- a/main.cpp
+++ b/main.cpp
@@ -19,49 +19,45 @@
*/
// KDE
-#include <KCmdLineArgs>
-#include <KApplication>
+#include <QFileDialog>
+#include <KLocalizedString>
#include <KAboutData>
-#include <KLocale>
-#include <KUrl>
-#include <KFileDialog>
-#include <KPushButton>
-#include <KDebug>
+#include <QApplication>
+#include <QPushButton>
#include "mainwindow.h"
#include "version.h"
int main(int argc, char *argv[])
{
- KAboutData aboutData("ktp-send-file", 0,
- ki18n("Telepathy Send File"),
+ QApplication app(argc, argv);
+ app.setWindowIcon(QIcon::fromTheme(QStringLiteral("telepathy-kde")));
+ KAboutData aboutData("ktp-send-file",
+ i18n("Telepathy Send File"),
KTP_SEND_FILE_VERSION);
- aboutData.addAuthor(ki18n("David Edmundson"), ki18n("Author"), "kde at davidedmundson.co.uk");
+ aboutData.addAuthor(i18n("David Edmundson"), i18n("Author"), "kde at davidedmundson.co.uk");
aboutData.setProductName("telepathy/send-file");
- aboutData.setProgramIconName(QLatin1String("telepathy-kde"));
+ KAboutData::setApplicationData(aboutData);
- KCmdLineArgs::init(argc, argv, &aboutData);
+ QCommandLineParser parser;
+ parser.addPositionalArgument("file", i18n("The files to send"), i18n("[files...]"));
+ parser.addHelpOption();
+ aboutData.setupCommandLine(&parser);
+ parser.process(app);
+ aboutData.processCommandLine(&parser);
- KCmdLineOptions options;
- options.add("+file", ki18n("The file to send"));
- KCmdLineArgs::addCmdLineOptions(options);
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- KApplication app;
+ QList<QUrl> filesToSend;
- KUrl::List filesToSend;
-
- if (args->count() == 0) {
- KFileDialog *fileDialog = new KFileDialog(KUrl("kfiledialog://telepathySendFile"), QString(), 0);
- fileDialog->setOperationMode(KFileDialog::Opening);
- fileDialog->setWindowTitle(i18n("Select Files To Send"));
- fileDialog->okButton()->setText(i18n("Send"));
- fileDialog->exec();
- filesToSend = fileDialog->selectedUrls();
- fileDialog->deleteLater();
+ if (parser.positionalArguments().isEmpty()) {
+ QFileDialog *fileDialog = new QFileDialog(Q_NULLPTR, i18n("Select Files To Send"));
+ fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
+ fileDialog->exec();
+ filesToSend = fileDialog->selectedUrls();
+ fileDialog->deleteLater();
} else {
- Q_FOREACH(QString fileToSend, args->allArguments().mid(1)) {
- filesToSend.append(KUrl(fileToSend));
+ Q_FOREACH(const QString &fileToSend, parser.positionalArguments()) {
+ filesToSend.append(QUrl::fromUserInput(fileToSend));
}
}
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 5d78b68..82237e4 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -22,16 +22,15 @@
#include "ui_mainwindow.h"
#include <KFileItem>
-#include <KApplication>
-#include <KMimeType>
-#include <KDebug>
-#include <KMessageBox>
#include <KPixmapSequence>
#include <KPixmapSequenceOverlayPainter>
-#include <KLineEdit>
+#include <KLocalizedString>
+#include <KIconLoader>
#include <KIO/PreviewJob>
-#include <QtGui/QPushButton>
+#include <QPushButton>
+#include <QMessageBox>
+#include <QLineEdit>
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/PendingChannelRequest>
@@ -43,9 +42,7 @@
#include <KTp/Models/contacts-filter-model.h>
#include <KTp/Widgets/contact-grid-widget.h>
-
-
-MainWindow::MainWindow(const KUrl::List &urls, QWidget *parent) :
+MainWindow::MainWindow(const QList<QUrl> &urls, QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWindow),
m_urls(urls),
@@ -61,7 +58,7 @@ MainWindow::MainWindow(const KUrl::List &urls, QWidget *parent) :
ui->fileNameLabel->setText(urls.first().fileName());
} else {
QString fileNames;
- Q_FOREACH(const KUrl &file, urls) {
+ Q_FOREACH(const QUrl &file, urls) {
fileNames += file.fileName() + " ";
}
setWindowTitle(i18n("Send files - %1", fileNames.trimmed()));
@@ -71,15 +68,13 @@ MainWindow::MainWindow(const KUrl::List &urls, QWidget *parent) :
ui->fileNameLabel->setText(fileNames.replace(" ", "<br />"));
}
- kDebug() << KApplication::arguments();
-
m_busyOverlay = new KPixmapSequenceOverlayPainter(this);
m_busyOverlay->setSequence(KPixmapSequence("process-working", 22));
m_busyOverlay->setWidget(ui->filePreview);
m_busyOverlay->start();
if (urls.size() == 1) {
- KFileItem file(KFileItem::Unknown, KFileItem::Unknown, urls.first());
+ KFileItem file(urls.first());
QStringList availablePlugins = KIO::PreviewJob::availablePlugins();
KIO::PreviewJob* job = KIO::filePreview(KFileItemList() << file, QSize(280, 280), &availablePlugins);
job->setOverlayIconAlpha(0);
@@ -124,7 +119,7 @@ MainWindow::MainWindow(const KUrl::List &urls, QWidget *parent) :
m_contactGridWidget = new KTp::ContactGridWidget(m_contactsModel, this);
- m_contactGridWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts..."));
+ m_contactGridWidget->contactFilterLineEdit()->setPlaceholderText(i18n("Search in Contacts..."));
m_contactGridWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected);
m_contactGridWidget->filter()->setCapabilityFilterFlags(KTp::ContactsFilterModel::FilterByFileTransferCapability);
ui->recipientVLayout->addWidget(m_contactGridWidget);
@@ -157,10 +152,10 @@ void MainWindow::onDialogAccepted()
}
// start sending file
- Q_FOREACH(const KUrl &url, m_urls) {
- Tp::PendingChannelRequest* channelRequest = KTp::Actions::startFileTransfer(m_contactGridWidget->selectedAccount(),
- m_contactGridWidget->selectedContact(),
- url.path());
+ Q_FOREACH(const QUrl &url, m_urls) {
+ Tp::PendingOperation* channelRequest = KTp::Actions::startFileTransfer(m_contactGridWidget->selectedAccount(),
+ m_contactGridWidget->selectedContact(),
+ url);
connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), SLOT(slotFileTransferFinished(Tp::PendingOperation*)));
}
@@ -184,11 +179,10 @@ void MainWindow::slotFileTransferFinished(Tp::PendingOperation* op)
if (op->isError()) {
//FIXME map to human readable strings.
QString errorMsg(op->errorName() + ": " + op->errorMessage());
- kDebug() << "ERROR!: " << errorMsg;
- KMessageBox::error(this, i18n("Failed to send file"), i18n("File Transfer Failed"));
+ qWarning() << "ERROR!: " << errorMsg;
+ QMessageBox::warning(this, i18n("Failed to send file"), i18n("File Transfer Failed"));
close();
} else {
- kDebug() << "Transfer started";
// now I can close the dialog
close();
}
@@ -203,7 +197,7 @@ void MainWindow::onPreviewLoaded(const KFileItem& item, const QPixmap& preview)
void MainWindow::onPreviewFailed(const KFileItem& item)
{
- kWarning() << "Loading thumb failed" << item.name();
+ qWarning() << "Loading thumb failed" << item.name();
ui->filePreview->setPixmap(KIconLoader::global()->loadIcon(item.iconName(), KIconLoader::Desktop, 128));
m_busyOverlay->stop();
}
diff --git a/mainwindow.h b/mainwindow.h
index 7055e00..592ef71 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -23,8 +23,6 @@
#include <QWidget>
-#include <KUrl>
-
#include <TelepathyQt/AccountManager>
#include <KTp/contact.h>
@@ -46,7 +44,7 @@ class MainWindow : public QWidget
Q_OBJECT
public:
- explicit MainWindow(const KUrl::List &urls, QWidget *parent = 0);
+ explicit MainWindow(const QList<QUrl> &urls, QWidget *parent = 0);
~MainWindow();
private Q_SLOTS:
@@ -59,7 +57,7 @@ private Q_SLOTS:
private:
Ui::MainWindow *ui;
- KUrl::List m_urls;
+ QList<QUrl> m_urls;
Tp::AccountManagerPtr m_accountManager;
KTp::ContactsListModel *m_contactsModel;
KTp::ContactGridWidget *m_contactGridWidget;
--
ktp-send-file packaging
More information about the pkg-kde-commits
mailing list