File indexing completed on 2024-04-14 14:55:11

0001 /** ===========================================================
0002  * @file
0003  *
0004  * This file is a part of KDE project
0005  * <a href="https://commits.kde.org/libmediawiki">libmediawiki</a>
0006  *
0007  * @date   2011-03-22
0008  * @brief  a MediaWiki C++ interface for KDE
0009  *
0010  * @author Copyright (C) 2011-2012 by Gilles Caulier
0011  *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
0012  * @author Copyright (C) 2009 by Richard Moore
0013  *         <a href="mailto:rich at kde dot org">rich at kde dot org</a>
0014  *
0015  * This program is free software; you can redistribute it
0016  * and/or modify it under the terms of the GNU General
0017  * Public License as published by the Free Software Foundation;
0018  * either version 2, or (at your option)
0019  * any later version.
0020  *
0021  * This program is distributed in the hope that it will be useful,
0022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0024  * GNU General Public License for more details.
0025  *
0026  * ============================================================ */
0027 
0028 #include <QString>
0029 
0030 #include "mediawiki.h"
0031 #include "mediawiki_p.h"
0032 
0033 namespace mediawiki
0034 {
0035 
0036 MediaWiki::MediaWiki(const QUrl& url, const QString& customUserAgent)
0037     : d_ptr(new MediaWikiPrivate(url,
0038                                  (customUserAgent.isEmpty() ? QString() 
0039                                                             : QString(customUserAgent + QStringLiteral("-"))) + MediaWikiPrivate::POSTFIX_USER_AGENT,
0040                                  new QNetworkAccessManager()))
0041 {
0042 }
0043 
0044 MediaWiki::~MediaWiki()
0045 {
0046     delete d_ptr;
0047 }
0048 
0049 QUrl MediaWiki::url() const
0050 {
0051     return d_ptr->url;
0052 }
0053 
0054 QString MediaWiki::userAgent() const
0055 {
0056     return d_ptr->userAgent;
0057 }
0058 
0059 QNetworkAccessManager* MediaWiki::manager() const
0060 {
0061     return d_ptr->manager;
0062 }
0063 
0064 } // namespace mediawiki