1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "pastebindotcomsettings.h"
35 #include "cpasterconstants.h"
36 #include "ui_pastebindotcomsettings.h"
38 #include <coreplugin/icore.h>
39 #include <QtCore/QSettings>
40 #include <QtCore/QCoreApplication>
42 static const char groupC[] = "PasteBinDotComSettings";
43 static const char prefixKeyC[] = "Prefix";
45 namespace CodePaster {
46 PasteBinDotComSettings::PasteBinDotComSettings()
48 m_settings = Core::ICore::instance()->settings();
50 const QString rootKey = QLatin1String(groupC) + QLatin1Char('/');
51 m_hostPrefix = m_settings->value(rootKey + QLatin1String(prefixKeyC), QString()).toString();
55 QString PasteBinDotComSettings::id() const
57 return QLatin1String("B.Pastebin.com");
60 QString PasteBinDotComSettings::displayName() const
62 return tr("Pastebin.com");
65 QString PasteBinDotComSettings::category() const
67 return QLatin1String(CodePaster::Constants::CPASTER_SETTINGS_CATEGORY);
70 QString PasteBinDotComSettings::displayCategory() const
72 return QCoreApplication::translate("CodePaster", CodePaster::Constants::CPASTER_SETTINGS_TR_CATEGORY);
75 QIcon PasteBinDotComSettings::categoryIcon() const
77 return QIcon(); // TODO: Icon for CodePaster
80 QWidget *PasteBinDotComSettings::createPage(QWidget *parent)
82 Ui_PasteBinComSettingsWidget ui;
83 QWidget *w = new QWidget(parent);
85 ui.lineEdit->setText(hostPrefix());
86 connect(ui.lineEdit, SIGNAL(textChanged(QString)), this, SLOT(serverChanged(QString)));
90 void PasteBinDotComSettings::apply()
95 m_settings->beginGroup(QLatin1String(groupC));
96 m_settings->setValue(QLatin1String(prefixKeyC), m_hostPrefix);
97 m_settings->endGroup();
100 void PasteBinDotComSettings::serverChanged(const QString &prefix)
102 m_hostPrefix = prefix;
105 QString PasteBinDotComSettings::hostPrefix() const
109 } //namespace CodePaster