Commit 624606c3 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some deprecated methods

parent 7fc8594b
......@@ -55,7 +55,7 @@ void SQLiteStore::load()
item.setDest(query.value(rec.indexOf("dest")).toString());
item.setSource(query.value(rec.indexOf("source")).toString());
item.setState(query.value(rec.indexOf("state")).toInt());
item.setDateTime(QDateTime::fromTime_t(query.value(rec.indexOf("time")).toUInt()));
item.setDateTime(QDateTime::fromSecsSinceEpoch(query.value(rec.indexOf("time")).toUInt()));
item.setSize(query.value(rec.indexOf("size")).toInt());
m_items << item;
......@@ -94,7 +94,7 @@ void SQLiteStore::saveItems(const QList<TransferHistoryItem> &items)
QSqlQuery query = sql().exec("insert into transfer_history_item(source, dest, size, time, state)"
"values ('"+item.source()+"', '"+item.dest()+"', "
+ QString::number(item.size()) + ", "
+ QString::number(item.dateTime().toTime_t()) + ", '"
+ QString::number(item.dateTime().toSecsSinceEpoch()) + ", '"
+ QString::number(item.state())+"')");
if (query.lastError().isValid()) {
......
......@@ -57,7 +57,7 @@ void XmlStore::SaveThread::run()
e.setAttribute("Source", m_item.source());
e.setAttribute("Dest", m_item.dest());
e.setAttribute("Time", QDateTime::currentDateTime().toTime_t());
e.setAttribute("Time", QDateTime::currentDateTime().toSecsSinceEpoch());
e.setAttribute("Size", QString::number(m_item.size()));
e.setAttribute("State", QString::number(m_item.state()));
......@@ -109,7 +109,7 @@ void XmlStore::DeleteThread::run()
item.setDest(element.attribute("Dest"));
item.setSource(element.attribute("Source"));
item.setSize(element.attribute("Size").toInt());
item.setDateTime(QDateTime::fromTime_t(element.attribute("Time").toUInt()));
item.setDateTime(QDateTime::fromSecsSinceEpoch(element.attribute("Time").toUInt()));
item.setState(element.attribute("State").toInt());
m_items << item;
}
......@@ -161,7 +161,7 @@ void XmlStore::LoadThread::run()
item.setDest(dom.attribute("Dest"));
item.setSource(dom.attribute("Source"));
item.setSize(dom.attribute("Size").toInt());
item.setDateTime(QDateTime::fromTime_t(dom.attribute("Time").toUInt()));
item.setDateTime(QDateTime::fromSecsSinceEpoch(dom.attribute("Time").toUInt()));
item.setState(dom.attribute("State").toInt());
emit elementLoaded(i, total, item);
......
......@@ -57,7 +57,8 @@ public:
QDBusConnection::sessionBus().registerObject("/KGet", wrapper);
} else {
// activate window if it is already open
KStartupInfo::setNewStartupId(kget, KStartupInfo::startupId());
kget->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(kget->windowHandle(), KStartupInfo::startupId());
KWindowSystem::forceActiveWindow(kget->winId());
}
......
......@@ -288,7 +288,7 @@ namespace kt
sort_column = col;
sort_order = order;
emit layoutAboutToBeChanged();
qStableSort(items.begin(),items.end(),ChunkDownloadModelItemCmp(col,order));
std::stable_sort(items.begin(),items.end(),ChunkDownloadModelItemCmp(col, order));
emit layoutChanged();
}
}
......@@ -411,7 +411,7 @@ namespace kt
sort_column = col;
sort_order = order;
emit layoutAboutToBeChanged();
qStableSort(items.begin(),items.end(),PeerViewModelItemCmp(col,order));
std::stable_sort(items.begin(),items.end(),PeerViewModelItemCmp(col, order));
emit layoutChanged();
}
}
......@@ -296,7 +296,7 @@ void TransferKio::slotStatResult(KJob* kioJob)
struct utimbuf time;
time.modtime = entryResult.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME);
time.actime = QDateTime::currentDateTime().toTime_t();
time.actime = QDateTime::currentDateTime().toSecsSinceEpoch();
utime(m_dest.toLocalFile().toUtf8().constData(), &time);
}
......
......@@ -178,7 +178,7 @@ bool MetalinkHttp::metalinkHttpInit()
qDebug() << "dest = " << dest;
//sort the urls according to their priority (highest first)
qStableSort(m_linkheaderList);
std::stable_sort(m_linkheaderList.begin(), m_linkheaderList.end());
DataSourceFactory *dataFactory = new DataSourceFactory(this,dest);
dataFactory->setMaxMirrorsUsed(MetalinkSettings::mirrorsPerFile());
......
......@@ -272,7 +272,7 @@ void TransferMultiSegKio::slotStatResult(KJob* kioJob)
struct utimbuf time;
time.modtime = entryResult.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME);
time.actime = QDateTime::currentDateTime().toTime_t();
time.actime = QDateTime::currentDateTime().toSecsSinceEpoch();
utime(m_dest.toLocalFile().toUtf8().constData(), &time);
}
......
......@@ -238,7 +238,7 @@ GroupStatusEditor::GroupStatusEditor(const QModelIndex &index, QWidget *parent)
m_stopBt->setChecked(true);
m_layout->addStretch();
m_layout->setMargin(1);
m_layout->setContentsMargins(1, 1, 1, 1);
connect(m_startBt, &GroupStatusButton::toggled, this, &GroupStatusEditor::slotStatusChanged);
}
......
......@@ -26,7 +26,7 @@ ViewsContainer::ViewsContainer(QWidget * parent)
{
QVBoxLayout *layout = new QVBoxLayout();
layout->setSpacing(1);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
m_transfersView = new TransfersView(this);
TransfersViewDelegate *transfersViewDelegate = new TransfersViewDelegate(m_transfersView);
......
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