AccountsModelPrivate::AccountsModelPrivate(AccountsModel *model)
 : m_manager(new Accounts::Manager(this))
 , q(model)
{
    m_accIdList = m_manager->accountList();
    m_accIdList.append(0); //For the dummy account Create

    connect(m_manager, SIGNAL(accountCreated(Accounts::AccountId)), 
            q, SLOT(accountCreated(Accounts::AccountId)));
    connect(m_manager, SIGNAL(accountRemoved(Accounts::AccountId)), 
            q, SLOT(accountRemoved(Accounts::AccountId)));
}
TransferEnginePrivate::TransferEnginePrivate(TransferEngine *parent):
    m_notificationsEnabled(true),
    m_settings(CONFIG_PATH, QSettings::IniFormat),
    q_ptr(parent)
{
    m_fileWatcherTimer = new QTimer(this);
    m_fileWatcherTimer->setSingleShot(true);
    connect(m_fileWatcherTimer, SIGNAL(timeout()), this, SLOT(enabledPluginsCheck()));

    m_fileWatcher = new QFileSystemWatcher(this);
    m_fileWatcher->addPath(SHARE_PLUGINS_PATH);
    connect(m_fileWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(pluginDirChanged()));

    m_accountManager = new Accounts::Manager("sharing", this);
    connect(m_accountManager, SIGNAL(accountCreated(Accounts::AccountId)), this, SLOT(enabledPluginsCheck()));
    connect(m_accountManager, SIGNAL(accountRemoved(Accounts::AccountId)), this, SLOT(enabledPluginsCheck()));
    connect(m_accountManager, SIGNAL(accountUpdated(Accounts::AccountId)), this, SLOT(enabledPluginsCheck()));

    // Exit safely stuff if we recieve certain signal or there are no active transfers
    Q_Q(TransferEngine);
    connect(TransferEngineSignalHandler::instance(), SIGNAL(exitSafely()), this, SLOT(exitSafely()));
    connect(q, SIGNAL(statusChanged(int,int)), this, SLOT(exitSafely()));

    // Monitor expired transfers and cleanup them if required
    m_activityMonitor = new ClientActivityMonitor(this);
    connect(m_activityMonitor, SIGNAL(transfersExpired(QList<int>)), this, SLOT(cleanupExpiredTransfers(QList<int>)));
}
void ShowXmlConsoleAction::init()
{
    connect(m_accountManager, SIGNAL(accountAdded(Account)), this, SLOT(updateShowXmlConsoleMenu()));
    connect(m_accountManager, SIGNAL(accountRemoved(Account)), this, SLOT(updateShowXmlConsoleMenu()));

    // It is needed bacause of loading protocol plugins before creating GUI.
    // TODO: Fix somehow. Maybe creating all action descriptions could be delayed.
    QTimer::singleShot(0, this, SLOT(insertMenuActionDescription()));
}
Exemple #4
0
	void MRIMProtocol::RemoveAccount (QObject *acc)
	{
		if (Accounts_.removeAll (qobject_cast<MRIMAccount*> (acc)))
		{
			emit accountRemoved (acc);
			saveAccounts ();
			acc->deleteLater ();
		}
	}
	void LocalBloggingPlatform::RemoveAccount (QObject *account)
	{
		auto acc = qobject_cast<LocalBlogAccount*> (account);
		if (Accounts_.removeAll (acc))
		{
			emit accountRemoved (account);
			account->deleteLater ();
			saveAccounts ();
		}
	}
Exemple #6
0
	void IrcProtocol::RemoveAccount (QObject *acc)
	{
		IrcAccount *accObj = qobject_cast<IrcAccount*> (acc);
		if (Accounts_.removeAll (accObj))
		{
			emit accountRemoved (accObj);
			accObj->deleteLater ();
			saveAccounts ();
		}
	}
void AccountManager::removeAccount(Account *account)
{
    emit accountRemoved(account);
    
    m_accounts.removeOne(account);
    account->remove();
    
    delete account;
    
    emit changed(true);
}
Exemple #8
0
void Protocol::removeAccount(Account *account, RemoveFlag flags)
{
	Config general = config().group("general");
	QStringList accounts = general.value("accounts",QStringList());
	accounts.removeAll(account->id());
	general.setValue("accounts",accounts);
	general.sync();
	emit accountRemoved(account);

	if (flags & DeleteAccount)
		account->deleteLater();
}
Exemple #9
0
	void AccountsManager::handleAccountRemoved (QObject *obj)
	{
		for (int i = 0; i < Model_->rowCount (); ++i)
		{
			if (Model_->item (i)->data (AccountObj).value<QObject*> () != obj)
				continue;

			Model_->removeRow (i);
			break;
		}

		emit accountRemoved (obj);
	}
Exemple #10
0
void Plugin::RemoveAccount (QObject *accObj)
{
    auto pos = std::find_if (Accounts_.begin (), Accounts_.end (),
                             [accObj] (decltype (Accounts_.front ()) acc)
    {
        return acc.get () == accObj;
    });
    if (pos == Accounts_.end ())
        return;

    emit accountRemoved (accObj);
    Accounts_.erase (pos);
    WriteAccounts ();
}
Exemple #11
0
	void ToxProtocol::RemoveAccount (QObject *accObj)
	{
		const auto account = qobject_cast<ToxAccount*> (accObj);
		if (!Accounts_.contains (account))
			return;

		QSettings settings { QSettings::IniFormat, QSettings::UserScope,
				QCoreApplication::organizationName (),
				QCoreApplication::applicationName () + "_Azoth_Sarin_Accounts" };
		settings.remove (account->GetAccountID ());

		Accounts_.removeOne (account);
		emit accountRemoved (accObj);
	}
void GlobalPresence::setAccountManager(const Tp::AccountManagerPtr &accountManager)
{
    if (! accountManager->isReady()) {
        qCWarning(KTP_COMMONINTERNALS) << "GlobalPresence used with unready account manager";
    }

    m_enabledAccounts = accountManager->enabledAccounts();
    m_onlineAccounts = accountManager->onlineAccounts();

    Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
        onAccountAdded(account);
    }

    onCurrentPresenceChanged();
    onRequestedPresenceChanged();
    onChangingPresence();
    onConnectionStatusChanged();

    connect(m_enabledAccounts.data(), SIGNAL(accountAdded(Tp::AccountPtr)), SLOT(onAccountAdded(Tp::AccountPtr)));
    connect(m_enabledAccounts.data(), SIGNAL(accountRemoved(Tp::AccountPtr)), this, SIGNAL(enabledAccountsChanged()));
}
Exemple #13
0
AccountsDaemon::AccountsDaemon(QObject *parent, const QList<QVariant>&)
 : KDEDModule(parent)
{
    QMetaObject::invokeMethod(this, "startDaemon", Qt::QueuedConnection);
    connect(KAccounts::accountsManager(), SIGNAL(accountCreated(Accounts::AccountId)), SLOT(accountCreated(Accounts::AccountId)));
    connect(KAccounts::accountsManager(), SIGNAL(accountRemoved(Accounts::AccountId)), SLOT(accountRemoved(Accounts::AccountId)));

    QStringList pluginPaths;

    QStringList paths = QCoreApplication::libraryPaths();
    Q_FOREACH (const QString &libraryPath, paths) {
        QString path(libraryPath + QStringLiteral("/kaccounts/daemonplugins"));
        QDir dir(path);

        if (!dir.exists()) {
            continue;
        }

        QStringList dirEntries = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);

        Q_FOREACH(const QString &file, dirEntries) {
            pluginPaths.append(path + '/' + file);
        }
void AccountWrapper::onRemoved()
{
    emit accountRemoved(this, false);
}
Exemple #15
0
QTM_BEGIN_NAMESPACE

/*!
    \class QMessageManager

    \brief The QMessageManager class represents the main interface for storage and retrieval
    of messages, folders and accounts in the system message store.


    \inmodule QtMessaging

    \ingroup messaging
    \since 1.0

    The system contains a single store for messages, which is accessed via the handle
    class QMessageManager.  QMessageManager provides the interface for adding, updating
    and deleting messages in the system's message store.

    QMessageManager provides the countFolders() and queryFolders() functions for
    counting and listing the folders contained by the messaging store, and the
    countAccounts() and queryAccounts() functions for counting and listing the
    accounts contained by the store.  These functions use the QMessageFolderFilter
    and QMessageFolderSortOrder classes, and the QMessageAccountFilter and
    QMessageAccountSortOrder classes to constrain their searches.

    QMessageManager also implements functionality allowing the messages contained by the
    store to be counted or listed, using various filtering and sortOrder constraints.
    Clients can access this functionality via the \l{QMessageService::countMessages()}{countMessages}
    and \l{QMessageService::queryMessages()}{queryMessages} functions of the
    QMessageService class.

    With the exception of Windows mobile and desktop platforms, QMessageManager functions
    should not initiate network activity. Instead functions are restricted to operating
    on data already on the device. See QMessageService for functions related to
    initiating network activity.

    If a QMessageManager operation fails, the error() function will return an error code
    value indicating the failure mode encountered.  A successful operation will set the
    error() result to QMessageManager::NoError.

    Messages in the messaging store are identified by QMessageId objects. The data associated
    with a message is retrieved in the form of a QMessage object using message(). Likewise
    a folder is retrieved in the form of a QMessageFolder object using folder(), and an
    account is retrieved in the form of a QMessageAccount object using account().

    Messages can be inserted into the store using the addMessage() function, messages in the
    store can be manipulated via the updateMessage() function, and removed by the
    removeMessage() functions.

    Messaging store manipulations involving messages are reported via the messagesAdded(),
    messagesUpdated() and messagesRemoved() signals.

    \sa QMessage, QMessageId, QMessageContentContainerId, QMessageService
*/

/*!
    \enum QMessageManager::RemovalOption

    Defines whether or not a message will be removed from the originating server.

    \value RemoveLocalCopyOnly        Do not remove the message from the originating server.
    \value RemoveOnOriginatingServer  Remove the message both from the local store and from the originating server if any.
*/

/*!
    \typedef QMessageManager::NotificationFilterId

    This type contains a value identifying a registered message filter.
*/

/*!
    \typedef QMessageManager::NotificationFilterIdSet

    This type contains a set of values identifying registered message filters.
*/

/*!
    \enum QMessageManager::Error

    Defines the result of attempting to perform a messaging store operation.

    \value NoError                The operation was successfully performed.
    \value InvalidId              The operation failed due to the specification of an invalid identifier.
    \value ConstraintFailure      The operation failed due to a constraint violation.
    \value ContentInaccessible    The operation failed because the content data cannot be accessed by the messaging store.
    \value NotYetImplemented      The operation failed because the messaging store does not yet implement the operation.
    \value FrameworkFault         The operation failed because the messaging store encountered an error in performing the operation.
    \value WorkingMemoryOverflow  The operation failed because the messaging store exhausted all memory available for evaluating queries.
    \value Busy                   The operation failed because the messaging store is being used by another thread.
    \value RequestIncomplete      The operation failed to report successful completion, although no specific error was reported.
*/

/*!
    \fn QMessageManager::QMessageManager(QObject *parent)

    Constructs a handle to the message store.

    If \a parent is not 0 then the handle will be deleted when \a parent is deleted.
*/
QMessageManager::QMessageManager(QObject *parent)
    : QObject(parent),
      store(QMessageStore::instance())
{
    connect(store, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)));
    connect(store, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)));
    connect(store, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)));

    connect(store, SIGNAL(accountRemoved(QMessageAccountId)), this, SIGNAL(accountRemoved(QMessageAccountId)));
}
Exemple #16
0
	void ProtoWrapper::handleAccountRemoved (AccountWrapper *aw)
	{
		Accounts_.removeAll (aw);
		emit accountRemoved (aw);
		aw->deleteLater ();
	}
void AccountsAwareObject::triggerAllAccountsRemoved()
{
	foreach (const Account &account, AccountManager::instance()->items())
		accountRemoved(account);
}
void AccountWrapper::init_state()
{
    if (!m_account->isEnabled())
        emit accountRemoved(this, false);
}
void AppletAvialabilityWidget::onRemoved()
{
    emit accountRemoved(this, false);
}
void AppletAvialabilityWidget::onStateChanged(bool value)
{
    emit accountRemoved(this, value);
}
void AppletAvialabilityWidget::init_state()
{
    if (!m_account->isEnabled())
        emit accountRemoved(this, false);
}
void EmailAccountListModel::onAccountsRemoved(const QMailAccountIdList &ids)
{
    Q_UNUSED(ids);
    QMailAccountListModel::reset();
    emit accountRemoved(QVariant(ids[0]));
}
Exemple #23
0
	MRIMProtocol::~MRIMProtocol ()
	{
		for (auto acc : Accounts_)
			emit accountRemoved (acc);
	}
void AccountWrapper::onStateChanged(bool value)
{
    emit accountRemoved(this, value);
}