Пример #1
0
void AccountsFunctions::createAccount() {
	enterName();
	enterPassword();
	cout << "Account successfully made!" << endl;
	saveAccounts();
	loginMenu();
}
Пример #2
0
	void IrcProtocol::RestoreAccounts ()
	{
		QSettings settings (QSettings::IniFormat, QSettings::UserScope,
				QCoreApplication::organizationName (),
				QCoreApplication::applicationName () + "_Azoth_Acetamide_Accounts");
		int size = settings.beginReadArray ("Accounts");
		for (int i = 0; i < size; ++i)
		{
			settings.setArrayIndex (i);
			QByteArray data = settings.value ("SerializedData").toByteArray ();
			
			IrcAccount *acc = IrcAccount::Deserialize (data, this);
			if (!acc)
			{
				qWarning () << Q_FUNC_INFO
						<< "unserializable acount"
						<< i;
				continue;
			}

			connect (acc,
					SIGNAL (accountSettingsChanged ()),
					this,
					SLOT (saveAccounts ()));
			
			if (acc->GetAccountName () == "DefaultIrcAccount")
				Core::Instance ().SetDefaultIrcAcoount (acc);
			else
				Accounts_ << acc;

			emit accountAdded (acc);
		}
	}
Пример #3
0
	void MRIMProtocol::RestoreAccounts ()
	{
		QSettings settings (QSettings::IniFormat, QSettings::UserScope,
				QCoreApplication::organizationName (),
				QCoreApplication::applicationName () + "_Azoth_Vader_Accounts");
		int size = settings.beginReadArray ("Accounts");
		for (int i = 0; i < size; ++i)
		{
			settings.setArrayIndex (i);
			const QByteArray& data = settings.value ("SerializedData").toByteArray ();
			MRIMAccount *acc = MRIMAccount::Deserialize (data, this);
			if (!acc)
			{
				qWarning () << Q_FUNC_INFO
						<< "undeserializable acount"
						<< i;
				continue;
			}

			connect (acc,
					SIGNAL (accountSettingsChanged ()),
					this,
					SLOT (saveAccounts ()));

			Accounts_ << acc;

			emit accountAdded (acc);
		}
		settings.endArray ();
	}
Пример #4
0
	void MRIMProtocol::RemoveAccount (QObject *acc)
	{
		if (Accounts_.removeAll (qobject_cast<MRIMAccount*> (acc)))
		{
			emit accountRemoved (acc);
			saveAccounts ();
			acc->deleteLater ();
		}
	}
Пример #5
0
	void DeliciousService::removeAccount (QObject *accObj)
	{
		DeliciousAccount *account = qobject_cast<DeliciousAccount*> (accObj);
		if (Accounts_.removeAll (account))
		{
			accObj->deleteLater ();
			saveAccounts ();
		}
	}
Пример #6
0
	void IrcProtocol::RemoveAccount (QObject *acc)
	{
		IrcAccount *accObj = qobject_cast<IrcAccount*> (acc);
		if (Accounts_.removeAll (accObj))
		{
			emit accountRemoved (accObj);
			accObj->deleteLater ();
			saveAccounts ();
		}
	}
Пример #7
0
	void LocalBloggingPlatform::RemoveAccount (QObject *account)
	{
		auto acc = qobject_cast<LocalBlogAccount*> (account);
		if (Accounts_.removeAll (acc))
		{
			emit accountRemoved (account);
			account->deleteLater ();
			saveAccounts ();
		}
	}
Пример #8
0
	void AccountsManager::AddAccountImpl (Account_ptr account)
	{
		Accounts_ << account;

		const QList<QStandardItem*> row
		{
			new QStandardItem { account->GetName () },
			new QStandardItem { account->GetServer () }
		};
		AccountsModel_->appendRow (row);

		connect (account.get (),
				SIGNAL (accountChanged ()),
				this,
				SLOT (saveAccounts ()));
		connect (account->GetFolderManager (),
				SIGNAL (foldersUpdated ()),
				this,
				SLOT (saveAccounts ()));
	}
Пример #9
0
	void Core::AddAccountImpl (Account_ptr account)
	{
		Accounts_ << account;

		QList<QStandardItem*> row;
		row << new QStandardItem (account->GetName ());
		row << new QStandardItem (account->GetServer ());
		row << new QStandardItem (account->GetType ());
		AccountsModel_->appendRow (row);

		ProgressManager_->AddAccount (account.get ());

		connect (account.get (),
				SIGNAL (accountChanged ()),
				this,
				SLOT (saveAccounts ()));
		connect (account->GetFolderManager (),
				SIGNAL (foldersUpdated ()),
				this,
				SLOT (saveAccounts ()));
	}
Пример #10
0
	void AccountsManager::InitiateAccountAddition ()
	{
		const auto acc = std::make_shared<Account> (ProgressMgr_);

		acc->OpenConfigDialog ([acc, this]
				{
					if (acc->IsNull ())
						return;

					AddAccountImpl (acc);

					saveAccounts ();
				});
	}
Пример #11
0
	void IrcProtocol::InitiateAccountRegistration ()
	{
		QString name = QInputDialog::getText (0,
				"LeechCraft",
				tr ("Enter new account name"));
		if (name.isEmpty ())
			return;
		
		IrcAccount *account = new IrcAccount (name, this);
		account->OpenConfigurationDialog ();

		connect (account,
				SIGNAL (accountSettingsChanged ()),
				this,
				SLOT (saveAccounts ()));

		Accounts_ << account;
		saveAccounts ();

		emit accountAdded (account);

// 		account->ChangeState (EntryStatus (SOnline, QString ()));
	}
Пример #12
0
// Allows the creation of a new user account.
void LogIn::createAccount()
{
	cout << "Enter your desired username: "******"Enter your desired password: ";
	cin >> pass;
	cin.get();
	password.push_back(pass);

	saveAccounts();

	BankAccount *bank = new BankAccount(user);
}
Пример #13
0
	void MRIMProtocol::RegisterAccount (const QString& name, const QList<QWidget*>& widgets)
	{
		auto w = qobject_cast<MRIMAccountConfigWidget*> (widgets.value (0));
		if (!w)
		{
			qWarning () << Q_FUNC_INFO
					<< "first widget is invalid"
					<< widgets;
			return;
		}

		MRIMAccount *acc = new MRIMAccount (name, this);
		acc->FillConfig (w);
		Accounts_ << acc;

		emit accountAdded (acc);

		saveAccounts ();
	}
Пример #14
0
	void LocalBloggingPlatform::RegisterAccount (const QString& name,
			const QList<QWidget*>& widgets)
	{
		auto w = qobject_cast<AccountConfigurationWidget*> (widgets.value (0));
		if (!w)
		{
			qWarning () << Q_FUNC_INFO
					<< "got invalid widgets"
					<< widgets;
			return;
		}

		LocalBlogAccount *account = new LocalBlogAccount (name, this);
		account->FillSettings (w);

		const QString& path = w->GetAccountBasePath ();
		if (!path.isEmpty ())
		{
			Accounts_ << account;
			saveAccounts ();
			emit accountAdded (account);
			account->Init ();
		}
	}
Пример #15
0
	void AccountsManager::AddAccount (Account_ptr account)
	{
		AddAccountImpl (account);

		saveAccounts ();
	}
Пример #16
0
	void Core::AddAccount (Account_ptr account)
	{
		AddAccountImpl (account);

		saveAccounts ();
	}
Пример #17
0
	void DeliciousService::readyReadReply ()
	{
		QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender ());
		if (!reply)
		{
			qWarning () << Q_FUNC_INFO
					<< sender ()
					<< "isn't a QNetworkReply";
			return;
		}

		QByteArray result = reply->readAll ();
		Entity e;
		Priority priority = PInfo_;
		QString msg;
		switch (Reply2Request_ [reply].Type_)
		{
		case OTAuth:
			if (DeliciousApi_->ParseAuthReply (result))
			{
				DeliciousAccount *account =
						new DeliciousAccount (Reply2Request_ [reply].Login_,
								this);
				account->SetPassword (Reply2Request_ [reply].Password_);
				Accounts_ << account;
				saveAccounts ();
				emit accountAdded (QObjectList () <<  account->GetQObject ());
				msg = tr ("Authentication successfull.");
				priority = LeechCraft::PInfo_;
			}
			else
			{
				msg = tr ("Invalid login or password.");
				priority = LeechCraft::PWarning_;
			}
			e = Util::MakeNotification ("OnlineBookmarks",
					msg,
					priority);
			break;
		case OTUpload:
			if (DeliciousApi_->ParseUploadReply (result))
			{
				if (Reply2Request_ [reply].Count_ == Reply2Request_ [reply].Current_ + 1)
				{
					msg = tr ("Bookmarks were sent to Del.icio.us.");
					priority = LeechCraft::PInfo_;
					DeliciousAccount *account = GetAccountByName (Reply2Request_ [reply].Login_);
					if (account)
						account->SetLastUploadDateTime (QDateTime::currentDateTime ());
					emit bookmarksUploaded ();
				}
			}
			else
			{
				msg = tr ("Error sending bookmarks to Del.icio.us.");
				priority = LeechCraft::PWarning_;
			}
			e = Util::MakeNotification ("OnlineBookmarks",
					msg,
					priority);
			break;
		case OTDownload:
			Account2ReplyContent_ [GetAccountByName (Reply2Request_ [reply].Login_)]
					.append (result);
			break;
		}
		if (!msg.isEmpty ())
			emit gotEntity (e);
	}
Пример #18
0
	void LocalBloggingPlatform::Release ()
	{
		saveAccounts ();
	}