2 This file is part of Blogilo, A KDE Blogging Client
4 Copyright (C) 2008-2010 Mehrdad Momeny <mehrdad.momeny@gmail.com>
5 Copyright (C) 2008-2010 Golnaz Nilieh <g382nilieh@gmail.com>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of
10 the License or (at your option) version 3 or any later version
11 accepted by the membership of KDE e.V. (or its successor approved
12 by the membership of KDE e.V.), which shall act as a proxy
13 defined in Section 14 of version 3 of the license.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, see http://www.gnu.org/licenses/
24 #include "sendtoblogdialog.h"
25 #include "ui_sendtoblogbase.h"
26 #include "blogilo_debug.h"
27 #include <KLocalizedString>
28 #include <KConfigGroup>
29 #include <QDialogButtonBox>
30 #include <QPushButton>
32 class SendToBlogDialog::Private
41 Ui::SendToBlogBase ui
;
45 SendToBlogDialog::SendToBlogDialog(bool isNew
, bool isPrivate
, QWidget
*parent
)
46 : QDialog(parent
), d(new Private
)
48 QVBoxLayout
*mainLayout
= new QVBoxLayout
;
49 setLayout(mainLayout
);
50 QWidget
*dialog
= new QWidget(this);
51 d
->ui
.setupUi(dialog
);
52 dialog
->setAttribute(Qt::WA_DeleteOnClose
);
53 QDialogButtonBox
*buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
54 QPushButton
*okButton
= buttonBox
->button(QDialogButtonBox::Ok
);
55 okButton
->setDefault(true);
56 okButton
->setShortcut(Qt::CTRL
| Qt::Key_Return
);
57 connect(buttonBox
, &QDialogButtonBox::accepted
, this, &SendToBlogDialog::accept
);
58 connect(buttonBox
, &QDialogButtonBox::rejected
, this, &SendToBlogDialog::reject
);
59 mainLayout
->addWidget(dialog
);
60 mainLayout
->addWidget(buttonBox
);
61 setWindowTitle(i18n("Submitting as..."));
63 d
->ui
.pubAsModify
->setEnabled(false);
64 d
->ui
.pubAsNewPost
->setChecked(true);
66 d
->ui
.pubAsModify
->setChecked(true);
69 d
->ui
.saveDraft
->setChecked(true);
72 d
->mIsPrivate
= isPrivate
;
75 SendToBlogDialog::~SendToBlogDialog()
80 bool SendToBlogDialog::isPrivate() const
85 bool SendToBlogDialog::isNew() const
90 void SendToBlogDialog::accept()
92 d
->mIsPrivate
= d
->ui
.saveDraft
->isChecked();
93 d
->mIsNew
= !d
->ui
.pubAsModify
->isChecked();