feat(ui/views/App/Main/MainWindow): add a hidden button to refresh registers

This commit is contained in:
Ronan Abhamon 2017-03-20 10:12:10 +01:00
parent dd09e6d3b1
commit 2069e990af
3 changed files with 34 additions and 0 deletions

View file

@ -26,6 +26,7 @@
#include "CoreManager.hpp"
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QTimer>
@ -77,10 +78,19 @@ void CoreManager::init (QObject *parent, const QString &config_path) {
);
}
// -----------------------------------------------------------------------------
VcardModel *CoreManager::createDetachedVcardModel () {
return new VcardModel(linphone::Factory::get()->createVcard());
}
void CoreManager::forceRefreshRegisters () {
qInfo() << QStringLiteral("Refresh registers.");
m_instance->m_core->refreshRegisters();
}
// -----------------------------------------------------------------------------
void CoreManager::setDatabasesPaths () {
m_core->setFriendsDatabasePath(Paths::getFriendsListFilepath());
m_core->setCallLogsDatabasePath(Paths::getCallHistoryFilepath());

View file

@ -100,6 +100,8 @@ public:
// Warning: The ownership of `VcardModel` is `QQmlEngine::JavaScriptOwnership` by default.
Q_INVOKABLE VcardModel *createDetachedVcardModel ();
Q_INVOKABLE void forceRefreshRegisters ();
private:
CoreManager (QObject *parent, const QString &config_path);

View file

@ -272,4 +272,26 @@ Controls1.ApplicationWindow {
}
}
}
// ---------------------------------------------------------------------------
// Hiden button to force registration.
// ---------------------------------------------------------------------------
Button {
anchors {
top: parent.top
left: parent.left
}
background: Rectangle {
color: 'transparent' // Not a style.
}
flat: true
height: accountStatus.height
width: MainWindowStyle.toolBar.leftMargin
onClicked: CoreManager.forceRefreshRegisters()
}
}