Commit 4ed4ad5d authored by Andrius Štikonas's avatar Andrius Štikonas
Browse files

Port some deprecated methods

parent 621a72f6
......@@ -40,12 +40,12 @@ ItemMimeData::~ItemMimeData()
{
}
void ItemMimeData::appendTransfer(const QWeakPointer<TransferHandler> &transfer)
void ItemMimeData::appendTransfer(const QPointer<TransferHandler> &transfer)
{
m_transfers.append(transfer);
}
QList<QWeakPointer<TransferHandler> > ItemMimeData::transfers() const
QList<QPointer<TransferHandler> > ItemMimeData::transfers() const
{
return m_transfers;
}
......@@ -583,7 +583,7 @@ QMimeData * TransferTreeModel::mimeData(const QModelIndexList &indexes) const
if (index.isValid() && index.column() == 0 && index.parent().isValid()) {
ModelItem *item = itemFromIndex(index);
if (!item->isGroup()) {
mimeData->appendTransfer(QWeakPointer<TransferHandler>(item->asTransfer()->transferHandler()));
mimeData->appendTransfer(QPointer<TransferHandler>(item->asTransfer()->transferHandler()));
}
}
}
......@@ -613,7 +613,7 @@ bool TransferTreeModel::dropMimeData(const QMimeData * mdata, Qt::DropAction act
qCDebug(KGET_DEBUG) << "TransferTreeModel::dropMimeData" << " " << row << " "
<< column << endl;
QList<QWeakPointer<TransferHandler> > transfers = itemData->transfers();
QList<QPointer<TransferHandler> > transfers = itemData->transfers();
qCDebug(KGET_DEBUG) << "TransferTreeModel::dropMimeData:" << transfers.count() << "transfers.";
const bool droppedInsideGroup = parent.isValid();
......@@ -635,7 +635,7 @@ bool TransferTreeModel::dropMimeData(const QMimeData * mdata, Qt::DropAction act
if (transfers[i].isNull()) {
qWarning() << "The moved transfer has been deleted inbetween.";
} else {
moveTransfer(transfers[i].toStrongRef().data()->m_transfer, destGroup, after);
moveTransfer(transfers[i].data()->m_transfer, destGroup, after);
}
}
return true;
......
......@@ -16,7 +16,7 @@
#include <QStandardItemModel>
#include <QList>
#include <QMimeData>
#include <QWeakPointer>
#include <QPointer>
#include <QUrl>
#include "kget_export.h"
......@@ -41,18 +41,18 @@ class ItemMimeData : public QMimeData
/**
* Appends a transfer to the list of transfers.
* The weakpointer is there to check later on, that the transfer still exists
* The pointer is there to check later on, that the transfer still exists
*/
void appendTransfer(const QWeakPointer<TransferHandler> &transfer);
void appendTransfer(const QPointer<TransferHandler> &transfer);
/**
* Returns all appended transfers
* The weakpointer is there to check later on, that the transfer still exists
* The pointer is there to check later on, that the transfer still exists
*/
QList<QWeakPointer<TransferHandler> > transfers() const;
QList<QPointer<TransferHandler> > transfers() const;
private:
QList<QWeakPointer<TransferHandler> > m_transfers;
QList<QPointer<TransferHandler> > m_transfers;
};
class KGET_EXPORT ModelItem : public QStandardItem
......
......@@ -8,7 +8,7 @@ QT5_ADD_DBUS_INTERFACE(kget_browser_integration_SRCS ../../dbus/org.kde.kget.mai
add_library(kget_browser_integration MODULE ${kget_browser_integration_SRCS})
target_link_libraries(kget_browser_integration ${KDE4_KDECORE_LIBS})
target_link_libraries(kget_browser_integration KF5::CoreAddons KF5::IconThemes KF5::Parts)
install(TARGETS kget_browser_integration DESTINATION ${PLUGIN_INSTALL_DIR})
......
......@@ -16,27 +16,27 @@
#include "kget_interface.h"
#include <QIcon>
#include <QMenu>
#include <QDBusConnection>
#include <KActionCollection>
#include <KToggleAction>
#include <KActionMenu>
#include <KFileItem>
#include <KIconLoader>
#include <KComponentData>
#include <KLocalizedString>
#include <KMessageBox>
#include <QMenu>
#include <KPluginFactory>
#include <KProtocolInfo>
#include <KParts/FileInfoExtension>
#include <KParts/HtmlExtension>
#include <KParts/Part>
#include <KParts/PartManager>
#include <KParts/ReadOnlyPart>
#include <KParts/SelectorInterface>
#include <KRun>
#include <QIcon>
#include <KToggleAction>
#include <KToolInvocation>
#include <KGenericFactory>
#include <KProtocolInfo>
#include <KFileItem>
#include <KDE/KParts/Part>
#include <KDE/KParts/PartManager>
#include <KDE/KParts/HtmlExtension>
#include <KDE/KParts/FileInfoExtension>
#include <QDBusConnection>
#define QL1S(x) QLatin1String(x)
......
......@@ -12,7 +12,7 @@
#ifndef KGETPLUGIN_H
#define KGETPLUGIN_H
#include <KDE/KParts/Plugin>
#include <KParts/Plugin>
#include <QPointer>
......
......@@ -151,17 +151,19 @@ namespace kt
void ChunkDownloadModel::changeTC(bt::TorrentInterface* tc)
{
beginResetModel();
qDeleteAll(items);
items.clear();
this->tc = tc;
reset();
endResetModel();
}
void ChunkDownloadModel::clear()
{
beginResetModel();
qDeleteAll(items);
items.clear();
reset();
endResetModel();
}
void ChunkDownloadModel::update()
......
......@@ -251,9 +251,10 @@ namespace kt
void PeerViewModel::clear()
{
beginResetModel();
qDeleteAll(items);
items.clear();
reset();
endResetModel();
}
void PeerViewModel::update()
......
......@@ -342,10 +342,11 @@ namespace kt
void TorrentFileTreeModel::onCodecChange()
{
beginResetModel();
delete root;
root = nullptr;
constructTree();
reset();
endResetModel();
}
int TorrentFileTreeModel::rowCount(const QModelIndex & parent) const
......
......@@ -44,6 +44,7 @@ namespace kt
void TrackerModel::changeTC(bt::TorrentInterface* tc)
{
beginResetModel();
qDeleteAll(trackers);
trackers.clear();
this->tc = tc;
......@@ -56,7 +57,7 @@ namespace kt
}
}
reset();
endResetModel();
}
void TrackerModel::update()
......
......@@ -43,6 +43,7 @@ namespace kt
void WebSeedsModel::changeTC(bt::TorrentInterface* tc)
{
beginResetModel();
curr_tc = tc;
items.clear();
if (tc)
......@@ -57,7 +58,7 @@ namespace kt
items.append(item);
}
}
reset();
endResetModel();
}
bool WebSeedsModel::update()
......
......@@ -30,7 +30,7 @@ ki18n_wrap_ui(kcm_kget_mmsfactory_PART_SRCS
)
kconfig_add_kcfg_files(kcm_kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
add_library(kcm_kget_mmsfactory MODULE ${kcm_kget_mmsfactory_PART_SRCS})
target_link_libraries(kcm_kget_mmsfactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
target_link_libraries(kcm_kget_mmsfactory KF5::I18n KF5::ConfigWidgets)
install(TARGETS kcm_kget_mmsfactory DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES kget_mmsfactory_config.desktop DESTINATION ${SERVICES_INSTALL_DIR})
......@@ -22,7 +22,7 @@
#include <QTime>
#include <kio/deletejob.h>
#include <KIO/DeleteJob>
#include "core/kget.h"
#include "mmsdownload.h"
#include "mmssettings.h"
......
......@@ -82,7 +82,7 @@ RangeTreeWidget::RangeTreeWidget(QWidget *parent) : QTreeView(parent),
setDragEnabled(false);
setAlternatingRowColors(true);
setEditTriggers(QAbstractItemView::NoEditTriggers);
header()->setMovable(false);
header()->setSectionsMovable(false);
// initialize the standard item model of the tree
m_model = new QStandardItemModel(this);
......
......@@ -66,6 +66,7 @@ int CountryModel::rowCount(const QModelIndex &parent) const
void CountryModel::setupModelData()
{
beginResetModel();
for (int c = 1; c <= QLocale::LastCountry; ++c)
{
QString countryCode;
......@@ -98,7 +99,7 @@ void CountryModel::setupModelData()
}
}
}
reset();
endResetModel();
}
LanguageModel::LanguageModel(QObject *parent)
......@@ -132,6 +133,7 @@ int LanguageModel::rowCount(const QModelIndex &parent) const
void LanguageModel::setupModelData()
{
beginResetModel();
for (int l = 1; l <= QLocale::LastLanguage; ++l)
{
const auto lang = static_cast<QLocale::Language>(l);
......@@ -146,7 +148,7 @@ void LanguageModel::setupModelData()
}
}
}
reset();
endResetModel();
}
......@@ -486,6 +486,7 @@ void MirrorModel::addMirror(const QUrl &url, int numConnections, int priority, c
void MirrorModel::setMirrors(const QHash<QUrl, QPair<bool, int> > &mirrors)
{
beginResetModel();
removeRows(0, rowCount());
QHash<QUrl, QPair<bool, int> >::const_iterator it;
......@@ -500,7 +501,7 @@ void MirrorModel::setMirrors(const QHash<QUrl, QPair<bool, int> > &mirrors)
m_data.append(item);
}
emit reset();
endResetModel();
}
QHash<QUrl, QPair<bool, int> > MirrorModel::availableMirrors() const
......
......@@ -134,7 +134,7 @@ MirrorSettings::MirrorSettings(QWidget *parent, TransferHandler *handler, const
KGuiItem::assign(ui.remove, KStandardGuiItem::remove());
KGuiItem::assign(ui.closeButton, KStandardGuiItem::close());
ui.treeView->setModel(m_proxy);
ui.treeView->header()->setResizeMode(QHeaderView::ResizeToContents);
ui.treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui.treeView->hideColumn(MirrorItem::Priority);
ui.treeView->hideColumn(MirrorItem::Country);
ui.treeView->setItemDelegate(new MirrorDelegate(this));
......
......@@ -39,7 +39,7 @@ TransfersView::TransfersView(QWidget * parent)
header()->setDefaultAlignment(Qt::AlignCenter);
header()->setMinimumSectionSize(80);
header()->setContextMenuPolicy(Qt::CustomContextMenu);
header()->setClickable(true);
header()->setSectionsClickable(true);
m_headerMenu = new QMenu(header());
setSelectionMode(QAbstractItemView::ExtendedSelection);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment