Skip to content

Commit

Permalink
[lipstick] Add cancelNofityLaunching API.
Browse files Browse the repository at this point in the history
This informs lipstick to stop notifying about launching desktop file.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Jan 21, 2021
1 parent 61e00d3 commit b6b3b65
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/launcherdbus.cpp
Expand Up @@ -83,3 +83,10 @@ void LauncherDBus::notifyLaunching(const QString &desktopFile)
model->notifyLaunching(desktopFile);
}
}

void LauncherDBus::cancelNotifyLaunching(const QString &desktopFile)
{
foreach (LauncherModel *model, m_models) {
model->cancelNotifyLaunching(desktopFile);
}
}
1 change: 1 addition & 0 deletions src/components/launcherdbus.h
Expand Up @@ -45,6 +45,7 @@ public slots:
void updatingProgress(QString packageName, int progress);
void updatingFinished(QString packageName);
void notifyLaunching(const QString &desktopFile);
void cancelNotifyLaunching(const QString &desktopFile);

signals:
void showUpdatingProgress(QString packageName);
Expand Down
2 changes: 2 additions & 0 deletions src/components/launcherfoldermodel.cpp
Expand Up @@ -414,6 +414,8 @@ void LauncherFolderModel::initialize()
this, SLOT(appAdded(QObject*)));
connect(m_launcherModel, (void (LauncherModel::*)(LauncherItem *))&LauncherModel::notifyLaunching,
this, &LauncherFolderModel::notifyLaunching);
connect(m_launcherModel, (void (LauncherModel::*)(LauncherItem *))&LauncherModel::canceledNotifyLaunching,
this, &LauncherFolderModel::canceledNotifyLaunching);
connect(&m_saveTimer, SIGNAL(timeout()), this, SLOT(save()));

QDir config;
Expand Down
1 change: 1 addition & 0 deletions src/components/launcherfoldermodel.h
Expand Up @@ -133,6 +133,7 @@ public slots:
void categoriesChanged();
void blacklistedApplicationsChanged();
void notifyLaunching(LauncherItem *item);
void canceledNotifyLaunching(LauncherItem *item);
void applicationRemoved(LauncherItem *item);

protected:
Expand Down
11 changes: 11 additions & 0 deletions src/components/launchermodel.cpp
Expand Up @@ -613,6 +613,17 @@ void LauncherModel::notifyLaunching(const QString &desktopFile)
}
}

void LauncherModel::cancelNotifyLaunching(const QString &desktopFile)
{
LauncherItem *item = itemInModel(desktopFile);
if (item) {
item->setIsLaunching(false);
emit canceledNotifyLaunching(item);
} else {
qWarning("No launcher item found for \"%s\".", qPrintable(desktopFile));
}
}

void LauncherModel::updateWatchedDBusServices()
{
QStringList requiredServices = m_packageNameToDBusService.values();
Expand Down
2 changes: 2 additions & 0 deletions src/components/launchermodel.h
Expand Up @@ -78,6 +78,7 @@ private slots:
void updatingProgress(const QString &packageName, int progress, const QString &serviceName);
void updatingFinished(const QString &packageName, const QString &serviceName);
void notifyLaunching(const QString &desktopFile);
void cancelNotifyLaunching(const QString &desktopFile);

void requestLaunch(const QString &packageName);
LauncherItem *itemInModel(const QString &path);
Expand All @@ -94,6 +95,7 @@ public slots:
void blacklistedApplicationsChanged();
void scopeChanged();
void notifyLaunching(LauncherItem *item);
void canceledNotifyLaunching(LauncherItem *item);

protected:
enum InitializationMode {
Expand Down

0 comments on commit b6b3b65

Please sign in to comment.