Exemplo n.º 1
0
			void MainWidget::handleChangeStatusRequested ()
			{
				QObject *obj = ActionChangeStatus_->data ().value<QObject*> ();
				if (!obj)
				{
					qWarning () << Q_FUNC_INFO
							<< "no object is set";
					return;
				}

				Plugins::IAccount *acc = qobject_cast<Plugins::IAccount*> (obj);
				if (!acc)
				{
					qWarning () << Q_FUNC_INFO
							<< "unable to cast"
							<< obj
							<< "to IAccount";
					return;
				}

				SetStatusDialog *ssd = new SetStatusDialog (this);
				if (ssd->exec () != QDialog::Accepted)
					return;

				acc->ChangeState (ssd->GetState (), ssd->GetStatusText ());
			}
Exemplo n.º 2
0
	void MainWidget::handleChangeStatusRequested ()
	{
		QAction *action = qobject_cast<QAction*> (sender ());
		if (!action)
		{
			qWarning () << Q_FUNC_INFO
					<< sender ()
					<< "is not an action";
			return;
		}

		QVariant stateVar = action->property ("Azoth/TargetState");
		EntryStatus status;
		if (!stateVar.isNull ())
		{
			const auto state = stateVar.value<State> ();
			status = EntryStatus (state, AccountActsMgr_->GetStatusText (action, state));
		}
		else
		{
			SetStatusDialog ssd ("global", this);
			if (ssd.exec () != QDialog::Accepted)
				return;

			status = EntryStatus (ssd.GetState (), ssd.GetStatusText ());
		}

		for (IAccount *acc : Core::Instance ().GetAccounts ())
			if (acc->IsShownInRoster ())
				acc->ChangeState (status);
		updateFastStatusButton (status.State_);
	}
Exemplo n.º 3
0
	void AccountActionsManager::handleChangeStatusRequested ()
	{
		auto action = qobject_cast<QAction*> (sender ());
		const auto acc = GetAccountFromSender (sender (), Q_FUNC_INFO);

		QVariant stateVar = action->property ("Azoth/TargetState");
		EntryStatus status;
		if (!stateVar.isNull ())
		{
			const auto state = stateVar.value<State> ();
			status = EntryStatus (state, GetStatusText (action, state));
		}
		else
		{
			SetStatusDialog ssd (acc->GetAccountID ());
			if (ssd.exec () != QDialog::Accepted)
				return;

			status = EntryStatus (ssd.GetState (), ssd.GetStatusText ());
		}

		acc->ChangeState (status);
	}