Example #1
0
	void HistoryModel::addItem (QString title, QString url,
			QDateTime date, QObject *browserWidget)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookAddingToHistory (proxy, title, url, date, browserWidget);
		if (proxy->IsCancelled ())
			return;

		QVariantList result = proxy->GetReturnValue ().toList ();
		int size = result.size ();
		if (size >= 1)
			title = result.at (0).toString ();
		if (size >= 2)
			url = result.at (1).toString ();
		if (size >= 3)
			date = result.at (2).toDateTime ();

		HistoryItem item =
		{
			title,
			date,
			url
		};
		Core::Instance ().GetStorageBackend ()->AddToHistory (item);
	}
Example #2
0
			void URLCompletionModel::setBase (const QString& str)
			{
				Valid_ = false;
				Base_ = str;
			
				Populate ();

				Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
				int size = Items_.size ();
				emit hookURLCompletionNewStringRequested (proxy, this, str, size);
				if (proxy->IsCancelled ())
				{
					int newSize = Items_.size ();
					if (newSize == size)
						Items_.clear ();
					else
					{
						history_items_t newItems;
						std::copy (Items_.begin (), Items_.begin () + newSize - size,
								std::back_inserter (newItems));
						Items_ = newItems;
					}
				}

				emit baseUpdated (sender ());
			}
Example #3
0
			QString ChatTab::FormatBody (QString body, Plugins::IMessage *msg)
			{
				QObject *msgObj = msg->GetObject ();

				Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
				emit hookFormatBodyBegin (proxy, &body, msgObj);
				if (!proxy->IsCancelled ())
				{
					body = Qt::escape (body);
					body.replace ('\n', "<br />");
					body.replace ("  ", "&nbsp; ");

					int pos = 0;
					while ((pos = LinkRegexp_.indexIn (body, pos)) != -1)
					{
						QString link = LinkRegexp_.cap (1);
						QString str = QString ("<a href=\"%1\">%1</a>")
								.arg (link);
						body.replace (pos, link.length (), str);

						pos += str.length ();
					}

					emit hookFormatBodyEnd (proxy, &body, msgObj);
				}

				return proxy->IsCancelled () ?
						proxy->GetReturnValue ().toString () :
						body;
			}
Example #4
0
	void Core::handleAddToFavorites (QString title, QString url)
	{
		Util::DefaultHookProxy_ptr proxy = Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy ());
		emit hookAddToFavoritesRequested (proxy, title, url);
		if (proxy->IsCancelled ())
			return;
		
		proxy->FillValue ("title", title);
		proxy->FillValue ("url", url);

		std::auto_ptr<AddToFavoritesDialog> dia (new AddToFavoritesDialog (title,
					url,
					qApp->activeWindow ()));

		bool result = false;
		do
		{
			if (dia->exec () == QDialog::Rejected)
				return;

			result = FavoritesModel_->addItem (dia->GetTitle (),
					url, dia->GetTags ());
		}
		while (!result);
	}
	void SeparateTabWidget::RemoveTab (int index)
	{
		if (index >= WidgetCount ())
		{
			qWarning () << Q_FUNC_INFO
					<< "invalid index"
					<< index;
			return;
		}

		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		const auto winId = Core::Instance ().GetRootWindowsManager ()->GetWindowIndex (Window_);
		emit hookTabIsRemoving (proxy, index, winId);
		if (proxy->IsCancelled ())
			return;

		const auto widget = Widget (index);

		if (widget == PreviousWidget_)
			PreviousWidget_ = 0;
		else if (widget == CurrentWidget_)
			CurrentWidget_ = 0;

		if (auto itw = qobject_cast<ITabWidget*> (widget))
			if (auto bar = itw->GetToolBar ())
				RemoveWidgetFromSeparateTabWidget (bar);

		if (!CurrentWidget_)
		{
			int nextIdx = -1;
			switch (MainTabBar_->selectionBehaviorOnRemove ())
			{
			case QTabBar::SelectLeftTab:
				nextIdx = index - 1;
				if (nextIdx == -1 && WidgetCount () > 1)
					nextIdx = 1;
				break;
			case QTabBar::SelectRightTab:
				nextIdx = index == WidgetCount () - 1 ?
						WidgetCount () - 2 :
						index + 1;
				break;
			default:
				nextIdx = IndexOf (PreviousWidget_);
				break;
			}

			if (nextIdx >= 0)
				setCurrentTab (nextIdx);
		}

		MainStackedWidget_->removeWidget (widget);
		MainTabBar_->removeTab (index);

		TabNames_.removeAt (index);

		widget->setParent (0);
	}
Example #6
0
			QString ChatTab::FormatNickname (QString nick, Plugins::IMessage *msg)
			{
				Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
				emit hookFormatNickname (proxy, &nick, msg->GetObject ());
				if (proxy->IsCancelled ())
					return nick;

				QString string;

				QString color = "green";
				if (msg->GetMessageType () == Plugins::IMessage::MTMUCMessage)
				{
					if (NickColors_.isEmpty ())
						GenerateColors ();

					if (!NickColors_.isEmpty ())
					{
						int hash = 0;
						for (int i = 0; i < nick.length (); ++i)
							hash += nick.at (i).unicode ();
						QColor nc = NickColors_.at (hash % NickColors_.size ());
						color = nc.name ();
					}

					QUrl url (QString ("azoth://msgeditreplace/%1")
							.arg (nick + ":"));

					string.append ("<span class='nickname'><a href='");
					string.append (url.toString () + "%20");
					string.append ("' class='nicklink' style='text-decoration:none; color:");
					string.append (color);
					string.append ("'>");
					string.append (nick);
					string.append ("</a></span>");
				}
				else
				{
					switch (msg->GetDirection ())
					{
						case Plugins::IMessage::DIn:
							color = "blue";
							break;
						case Plugins::IMessage::DOut:
							color = "red";
							break;
					}

					string = QString ("<span class='nickname' style='color:%2'>%1</span>")
							.arg (nick)
							.arg (color);
				}

				return string;
			}
Example #7
0
			QString ChatTab::FormatDate (QDateTime dt, Plugins::IMessage *msg)
			{
				Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
				emit hookFormatDateTime (proxy, &dt, msg->GetObject ());
				if (proxy->IsCancelled ())
					return proxy->GetReturnValue ().toString ();

				QString str = dt.time ().toString ();
				return QString ("<span class='datetime' style='color:green'>[" +
						str + "]</span>");
			}
Example #8
0
	void CustomWebPage::handleJavaScriptWindowObjectCleared ()
	{
		QWebFrame *frame = qobject_cast<QWebFrame*> (sender ());
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy ());
		emit hookJavaScriptWindowObjectCleared (proxy, this, frame);
		if (proxy->IsCancelled ())
			return;

		frame->addToJavaScriptWindowObject ("JSProxy", JSProxy_.get ());
		frame->addToJavaScriptWindowObject ("external", ExternalProxy_.get ());
	}
Example #9
0
	QString CustomWebPage::chooseFile (QWebFrame *frame, const QString& thsuggested)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QString suggested = thsuggested;
		emit hookChooseFile (proxy, this, frame, suggested);
		if (proxy->IsCancelled ())
			return proxy->GetReturnValue ().toString ();

		proxy->FillValue ("suggested", suggested);

		return QWebPage::chooseFile (frame, suggested);
	}
Example #10
0
QString Core::GetUserAgent (const QUrl& url, const QWebPage *page) const
{
    Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy ());
    emit hookUserAgentForUrlRequested (proxy, url, page);
    if (proxy->IsCancelled ())
    {
        qDebug () << proxy->GetReturnValue ().toString ();
        return proxy->GetReturnValue ().toString ();
    }

    return QString ();
}
Example #11
0
	void Core::RestoreSession (bool ask)
	{
		if (!SavedSessionState_.size ()) ;
		else if (ask)
		{
			std::auto_ptr<RestoreSessionDialog> dia (new RestoreSessionDialog (Core::Instance ().GetProxy ()->GetMainWindow ()));
			bool added = false;
			for (int i = 0; i < SavedSessionState_.size (); ++i)
			{
				QPair<QString, QString> pair = SavedSessionState_.at (i);
				QString title = pair.first;
				QString url = pair.second;
				if (url.isEmpty ())
					continue;
				dia->AddPair (title, url);
				added = true;
			}

			if (added &&
					dia->exec () == QDialog::Accepted)
			{
				RestoredURLs_ = dia->GetSelectedURLs ();
				QTimer::singleShot (2000, this, SLOT (restorePages ()));
			}
			else
				saveSession ();
		}
		else
		{
			for (int i = 0; i < SavedSessionState_.size (); ++i)
			{
				QString url = SavedSessionState_.at (i).second;
				if (url.isEmpty ())
					continue;
				RestoredURLs_ << i;
			}
			QTimer::singleShot (2000, this, SLOT (restorePages ()));
		}
		
		QList<QUrl> toRestore;
		Q_FOREACH (int idx, RestoredURLs_)
			toRestore << SavedSessionState_ [idx].second;
		
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookSessionRestoreScheduled (proxy,
				toRestore);
		if (proxy->IsCancelled ())
		{
			RestoredURLs_.clear ();
			SavedSessionState_.clear ();
		}
	}
Example #12
0
	void CustomWebPage::javaScriptAlert (QWebFrame *frame, const QString& thmsg)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QString msg = thmsg;
		emit hookJavaScriptAlert (proxy,
				this, frame, msg);
		if (proxy->IsCancelled ())
			return;

		proxy->FillValue ("message", msg);

		QWebPage::javaScriptAlert (frame, msg);
	}
Example #13
0
	bool CustomWebPage::javaScriptConfirm (QWebFrame *frame, const QString& thmsg)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QString msg = thmsg;
		emit hookJavaScriptConfirm (proxy,
				this, frame, msg);
		if (proxy->IsCancelled ())
			return proxy->GetReturnValue ().toBool ();

		proxy->FillValue ("message", msg);

		return QWebPage::javaScriptConfirm (frame, msg);
	}
Example #14
0
	bool CustomWebPage::acceptNavigationRequest (QWebFrame *frame,
			const QNetworkRequest& other, QWebPage::NavigationType type)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QNetworkRequest request = other;
		emit hookAcceptNavigationRequest (proxy, this, frame, request, type);
		if (proxy->IsCancelled ())
			return proxy->GetReturnValue ().toBool ();

		proxy->FillValue ("request", request);

		QString scheme = request.url ().scheme ();
		if (scheme == "mailto" ||
				scheme == "ftp")
		{
			const auto& e = Util::MakeEntity (request.url (),
					QString (),
					FromUserInitiated);
			auto em = Core::Instance ().GetProxy ()->GetEntityManager ();
			if (em->CouldHandle (e))
				em->HandleEntity (e);
			else
				QDesktopServices::openUrl (request.url ());
			return false;
		}

		if (frame)
			HandleForms (frame, request, type);

		if (type == NavigationTypeLinkClicked &&
				(MouseButtons_ == Qt::MidButton ||
					Modifiers_ & Qt::ControlModifier))
		{
			bool invert = Modifiers_ & Qt::ShiftModifier;

			CustomWebView *view = Core::Instance ().MakeWebView (invert);
			view->Load (request);

			MouseButtons_ = Qt::NoButton;
			Modifiers_ = Qt::NoModifier;
			return false;
		}

		if (frame == mainFrame ())
			LoadingURL_ = request.url ();

		return QWebPage::acceptNavigationRequest (frame, request, type);
	}
Example #15
0
	void CustomWebPage::handleDownloadRequested (const QNetworkRequest& other)
	{
		QNetworkRequest request = other;
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookDownloadRequested (proxy, this, request);
		if (proxy->IsCancelled ())
			return;

		proxy->FillValue ("request", request);

		Entity e = Util::MakeEntity (request.url (),
				QString (),
				FromUserInitiated);
		e.Additional_ ["AllowedSemantics"] = QStringList ("fetch") << "save";
		e.Additional_ ["IgnorePlugins"] = "org.LeechCraft.Poshuku";
		emit gotEntity (e);
	}
Example #16
0
	void CustomWebPage::javaScriptConsoleMessage (const QString& thmsg, int line,
			const QString& thsid)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QString msg = thmsg;
		QString sid = thsid;
		emit hookJavaScriptConsoleMessage (proxy,
				this, msg, line, sid);
		if (proxy->IsCancelled ())
			return;

		proxy->FillValue ("message", msg);
		proxy->FillValue ("line", line);
		proxy->FillValue ("sourceID", sid);

		QWebPage::javaScriptConsoleMessage (msg, line, sid);
	}
Example #17
0
void Core::handleAddToFavorites (QString title, QString url)
{
    Util::DefaultHookProxy_ptr proxy = Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy ());
    emit hookAddToFavoritesRequested (proxy, title, url);
    if (proxy->IsCancelled ())
        return;

    proxy->FillValue ("title", title);
    proxy->FillValue ("url", url);

    bool oneClick = XmlSettingsManager::Instance ()->property ("BookmarkInOneClick").toBool ();

    const auto& index = FavoritesModel_->addItem (title, url, QStringList ());

    if (!oneClick)
        FavoritesModel_->EditBookmark (index);

    emit bookmarkAdded (url);
}
Example #18
0
	QIcon Core::GetIcon (const QUrl& url) const
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy ());
		emit hookIconRequested (proxy, url);
		if (proxy->IsCancelled ())
			return proxy->GetReturnValue ().value<QIcon> ();

		QIcon result = QWebSettings::iconForUrl (url);
		if (!result.isNull ())
			return result;

		QUrl test;
		test.setScheme (url.scheme ());
		test.setHost (url.host ());

		result = QWebSettings::iconForUrl (test);
		if (!result.isNull ())
			return result;

		return QWebSettings::webGraphic (QWebSettings::DefaultFrameIconGraphic);
	}
Example #19
0
	bool CLModel::CheckHookDnDEntry2Entry (const QMimeData *mime, int row, const QModelIndex& parent)
	{
		if (row != -1 ||
				!mime->hasFormat (CLEntryFormat) ||
				parent.data (Core::CLREntryType).value<Core::CLEntryType> () != Core::CLETContact)
			return false;

		QDataStream stream (mime->data (CLEntryFormat));
		QString sid;
		stream >> sid;

		QObject *source = Core::Instance ().GetEntry (sid);
		if (!source)
			return false;

		QObject *target = parent.data (Core::CLREntryObject).value<QObject*> ();

		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookDnDEntry2Entry (proxy, source, target);
		return proxy->IsCancelled ();
	}
Example #20
0
	void CustomWebPage::handleLoadFinished (bool ok)
	{
		QWebElement body = mainFrame ()->findFirstElement ("body");

		if (body.findAll ("*").count () == 1 &&
				body.firstChild ().tagName () == "IMG")
			mainFrame ()->evaluateJavaScript ("function centerImg() {"
					"var img = document.querySelector('img');"
					"img.style.left = Math.floor((document.width - img.width) / 2) + 'px';"
					"img.style.top =  Math.floor((document.height - img.height) / 2) + 'px';"
					"img.style.position = 'absolute';"
					"}"
					"window.addEventListener('resize', centerImg, false);"
					"centerImg();");

		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy ());
		emit hookLoadFinished (proxy, this, ok);
		if (proxy->IsCancelled ())
			return;

		emit delayedFillForms (mainFrame ());
	}
Example #21
0
	QWebPage* CustomWebPage::createWindow (QWebPage::WebWindowType type)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookCreateWindow (proxy, this, type);
		if (proxy->IsCancelled ())
			return qobject_cast<QWebPage*> (proxy->GetReturnValue ().value<QObject*> ());

		switch (type)
		{
		case QWebPage::WebBrowserWindow:
			return Core::Instance ().NewURL (QUrl ())->GetView ()->page ();
		case QWebPage::WebModalDialog:
			{
				BrowserWidget *widget = new BrowserWidget (view ());
				widget->InitShortcuts ();
				widget->setWindowFlags (Qt::Dialog);
				widget->setAttribute (Qt::WA_DeleteOnClose);
				widget->setWindowModality (Qt::ApplicationModal);
				connect (widget,
						SIGNAL (gotEntity (const LeechCraft::Entity&)),
						&Core::Instance (),
						SIGNAL (gotEntity (const LeechCraft::Entity&)));
				connect (widget,
						SIGNAL (titleChanged (const QString&)),
						widget,
						SLOT (setWindowTitle (const QString&)));
				widget->show ();
				return widget->GetView ()->page ();
			}
		default:
			qWarning () << Q_FUNC_INFO
					<< "unknown type"
					<< type;
			return 0;
		}
	}
Example #22
0
	QObject* CustomWebPage::createPlugin (const QString& thclsid, const QUrl& thurl,
			const QStringList& thnames, const QStringList& thvalues)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QString clsid = thclsid;
		QUrl url = thurl;
		QStringList names = thnames;
		QStringList values = thvalues;
		emit hookCreatePlugin (proxy, this,
				clsid, url, names, values);
		if (proxy->IsCancelled ())
			return proxy->GetReturnValue ().value<QObject*> ();

		proxy->FillValue ("clsid", clsid);
		proxy->FillValue ("url", url);
		proxy->FillValue ("names", names);
		proxy->FillValue ("values", values);

		return QWebPage::createPlugin (clsid, url, names, values);
	}
Example #23
0
	bool CustomWebPage::javaScriptPrompt (QWebFrame *frame, const QString& thpr,
			const QString& thdef, QString *result)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		QString pr = thpr;
		QString def = thdef;
		emit hookJavaScriptPrompt (proxy,
				this, frame, pr, def, *result);
		proxy->FillValue ("result", *result);
		if (proxy->IsCancelled ())
			return proxy->GetReturnValue ().toBool ();

		proxy->FillValue ("message", pr);
		proxy->FillValue ("default", def);

		return QWebPage::javaScriptPrompt (frame, pr, def, result);
	}
Example #24
0
	void CustomWebPage::handleUnsupportedContent (QNetworkReply *reply)
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookUnsupportedContent (proxy, this, reply);
		if (proxy->IsCancelled ())
			return;

		std::shared_ptr<void> replyGuard = std::shared_ptr<void> (nullptr,
				[reply] (void*) -> void
				{
					reply->abort ();
					reply->deleteLater ();
				});

		const auto& url = reply->url ();
		const auto& mime = reply->header (QNetworkRequest::ContentTypeHeader).toString ();

		qDebug () << Q_FUNC_INFO << reply->url () << reply->errorString ();

		auto sendEnt = [reply, mime, url, this] () -> void
		{
			auto e = Util::MakeEntity (url,
					{},
					LeechCraft::FromUserInitiated,
					mime);
			e.Additional_ ["IgnorePlugins"] = "org.LeechCraft.Poshuku";
			emit gotEntity (e);

			if (XmlSettingsManager::Instance ()->
					property ("CloseEmptyDelegatedPages").toBool () &&
					history ()->currentItem ().url ().isEmpty ())
				emit windowCloseRequested ();
		};

		switch (reply->error ())
		{
		case QNetworkReply::ProtocolUnknownError:
			if (XmlSettingsManager::Instance ()->
					property ("ExternalSchemes").toString ().split (' ')
					.contains (url.scheme ()))
				QDesktopServices::openUrl (url);
			else
				sendEnt ();
			break;
		case QNetworkReply::NoError:
		{
			auto found = FindFrame (url);
			if (!found)
			{
				if (XmlSettingsManager::Instance ()->
						property ("ParanoidDownloadsDetection").toBool () ||
						!mime.isEmpty ())
				{
					sendEnt ();
					break;
				}
				else
					qDebug () << Q_FUNC_INFO
							<< mime;
			}
			else
				qDebug () << Q_FUNC_INFO
					<< "but frame is found";
		}
		default:
		{
			int statusCode = reply->attribute (QNetworkRequest::HttpStatusCodeAttribute).toInt ();

			qDebug () << Q_FUNC_INFO
					<< "general unsupported content"
					<< url
					<< reply->error ()
					<< reply->errorString ();

			const auto& data = MakeErrorReplyContents (statusCode,
					url, reply->errorString (), QtNetwork);

			if (auto found = FindFrame (url))
				found->setHtml (data, url);
			else if (LoadingURL_ == url)
				mainFrame ()->setHtml (data, url);
			break;
		}
		}
	}
Example #25
0
	QString Core::GetUserAgent (const QUrl& url, const QWebPage *page) const
	{
		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy ());
		emit hookUserAgentForUrlRequested (proxy, url, page);
		if (proxy->IsCancelled ())
		{
			qDebug () << proxy->GetReturnValue ().toString ();
			return proxy->GetReturnValue ().toString ();
		}

		return QString ();

		/*
#if defined (Q_OS_WINCE) || defined (Q_OS_WIN32) || defined (Q_OS_MSDOS)
		QString winver = "unknown Windows";
		switch (QSysInfo::windowsVersion ())
		{
			case QSysInfo::WV_32s:
				winver = "Windows 3.1 with Win32s";
				break;
			case QSysInfo::WV_95:
				winver = "Windows 95";
				break;
			case QSysInfo::WV_98:
				winver = "Windows 98";
				break;
			case QSysInfo::WV_Me:
				winver = "Windows ME";
				break;
			case QSysInfo::WV_NT:
				winver = "Windows NT";
				break;
			case QSysInfo::WV_2000:
				winver = "Windows 2000";
				break;
			case QSysInfo::WV_XP:
				winver = "Windows XP";
				break;
			case QSysInfo::WV_2003:
				winver = "Windows 2003";
				break;
			case QSysInfo::WV_VISTA:
				winver = "Windows Vista";
				break;
			case QSysInfo::WV_WINDOWS7:
				winver = "Windows 7";
				break;
			case QSysInfo::WV_CE:
				winver = "Windows CE";
				break;
			case QSysInfo::WV_CENET:
				winver = "Windows CE .NET";
				break;
			case QSysInfo::WV_CE_5:
				winver = "Windows CE 5.x";
				break;
			case QSysInfo::WV_CE_6:
				winver = "Windows CE 6.x";
				break;
			case QSysInfo::WV_DOS_based:
				winver = "unknown DOS-based";
				break;
			case QSysInfo::WV_NT_based:
				winver = "unknown NT-based";
				break;
			case QSysInfo::WV_CE_based:
				winver = "unknown CE-based";
				break;
		}
#elif defined (Q_OS_DARWIN)
		QString macver;
		switch (QSysInfo::MacintoshVersion)
		{
			case QSysInfo::MV_CHEETAH:
				macver = "Cheetah";
				break;
			case QSysInfo::MV_PUMA:
				macver = "Puma";
				break;
			case QSysInfo::MV_JAGUAR:
				macver = "Jaguar";
				break;
			case QSysInfo::MV_PANTHER:
				macver = "Panther";
				break;
			case QSysInfo::MV_TIGER:
				macver = "Tiger";
				break;
			case QSysInfo::MV_LEOPARD:
				macver = "Leopard";
				break;
			case QSysInfo::MV_SNOWLEOPARD:
				macver = "Snow Leopard";
				break;
			default:
				macver = "unknown Mac OS ";
				break;
		}
#endif
		return QString ("LeechCraft (%1; %2; %3; %4) (LeechCraft/Poshuku %5; WebKit %6/%7)")
			// %1 platform
#ifdef Q_WS_MAC
			.arg ("MacOS")
#elif defined (Q_WS_WIN)
			.arg ("Windows")
#elif defined (Q_WS_X11)
			.arg ("X11")
#elif defined (Q_WS_QWS)
			.arg ("QWS")
#else
			.arg ("compatible")
#endif
			// %2 security
			.arg (QSslSocket::supportsSsl () ? "U" : "N")
			// %3 subplatform
#ifdef Q_OS_AIX
			.arg ("AIX")
#elif defined (Q_OS_BSD4)
			.arg ("BSD 4.4")
#elif defined (Q_OS_BSDI)
			.arg ("BSD/OS")
#elif defined (Q_OS_CYGWIN)
			.arg ("Cygwin")
#elif defined (Q_OS_DARWIN)
			.arg (macver)
#elif defined (Q_OS_DGUX)
			.arg ("DG/UX")
#elif defined (Q_OS_DYNIX)
			.arg ("DYNIX/ptx")
#elif defined (Q_OS_FREEBSD)
			.arg ("FreeBSD")
#elif defined (Q_OS_HPUX)
			.arg ("HP-UX")
#elif defined (Q_OS_HURD)
			.arg ("GNU Hurd")
#elif defined (Q_OS_IRIX)
			.arg ("IRIX")
#elif defined (Q_OS_LINUX)
			.arg ("Linux")
#elif defined (Q_OS_LYNX)
			.arg ("LynxOS")
#elif defined (Q_OS_NETBSD)
			.arg ("NetBSD")
#elif defined (Q_OS_OPENBSD)
			.arg ("OpenBSD")
#elif defined (Q_OS_OS2)
			.arg ("OS/2")
#elif defined (Q_OS_OS2EMX)
			.arg ("OS/2 XFree86")
#elif defined (Q_OS_OSF)
			.arg ("HP Tru64 UNIX")
#elif defined (Q_OS_QNX6)
			.arg ("QNX RTP 6.1")
#elif defined (Q_OS_QNX)
			.arg ("QNX")
#elif defined (Q_OS_RELIANT)
			.arg ("Reliant UNIX")
#elif defined (Q_OS_SCO)
			.arg ("SCO OpenServer 5")
#elif defined (Q_OS_SOLARIS)
			.arg ("Sun Solaris")
#elif defined (Q_OS_ULTRIX)
			.arg ("DEC Ultrix")
#elif defined (Q_OS_UNIXWARE)
			.arg ("UnixWare 7 or Open UNIX 8")
#elif defined (Q_OS_WINCE) || defined (Q_OS_WIN32) || defined (Q_OS_MSDOS)
			.arg (winver)
#elif defined (Q_OS_UNIX)
			.arg ("any UNIX BSD/SYSV")
#else
#warning "Unknown OS"
			.arg ("unknown subplatform")
#endif
			// %4 locale
			.arg (QLocale::system ().name ())
			.arg (LEECHCRAFT_VERSION)
			.arg (QT_VERSION_STR)
			.arg (qVersion ());
			*/
	}