2
* activeprofiles.cpp - Class for interacting with other psi instances
3
* Copyright (C) 2006 Maciej Niedzielski
4
* Copyright (C) 2006-2007 Martin Hostettler
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this library; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
#include "activeprofiles.h"
23
#include <QMessageBox>
27
ActiveProfiles* ActiveProfiles::instance_ = 0;
30
* \fn virtual ActiveProfiles::~ActiveProfiles();
31
* \brief Destroys the object.
35
* \fn bool ActiveProfiles::isActive(const QString &profile) const;
36
* \brief Returns true is \a profile is running.
40
* \fn bool ActiveProfiles::setThisProfile(const QString &profile);
41
* \brief Registeres this application instance as \a profile.
42
* Note: you can call this function multiple times with the same value of \a profile.
46
* \fn void ActiveProfiles::unsetThisProfile();
47
* \brief Unregistered this application profile.
51
* \fn QString ActiveProfiles::thisProfile() const;
52
* \brief Returns the profile name registered for this application instance.
53
* Returns empty string if no profile is registered.
57
* \fn ActiveProfiles::ActiveProfiles(const QString &name);
58
* \brief Creates new object and registers this application with its \a name.
62
* \brief Returns the instance of ActiveProfiles.
64
ActiveProfiles* ActiveProfiles::instance()
67
instance_ = new ActiveProfiles();
74
* \fn ActiveProfiles::ActiveProfiles()
75
* \brief Creates new object.
80
* \fn bool ActiveProfiles::raiseOther(QString profile, bool withUI) const
81
* \brief raises the main windows of another psi instance.
85
* \brief Requests other Psi instance to open \a uri.
86
* If \a profile is not running, other active instance is selected.
87
* If the request cannot be sent, function returns false.
89
bool ActiveProfiles::sendOpenUri(const QUrl &uri, const QString &profile) const
91
return sendOpenUri(uri.toString(), profile);
95
* \fn bool ActiveProfiles::sendOpenUri(const QString &uri, const QString &profile) const
96
* \brief Requests other Psi instance to open \a uri.
97
* If \a profile is not running, other active instance is selected.
98
* If the request cannot be sent, function returns false.
103
* \fn void ActiveProfiles::openUri(const QUrl &uri);
104
* \brief Signal emitted when other Psi instance requested to open \a uri.
108
* \brief Picks one of running Psi instances and returns its profile name.
110
QString ActiveProfiles::pickProfile() const
112
QStringList profiles = getProfilesList();
113
foreach (QString p, profiles) {