summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtBookmarkDetailWindow.cpp')
-rw-r--r--Swift/QtUI/QtBookmarkDetailWindow.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/Swift/QtUI/QtBookmarkDetailWindow.cpp b/Swift/QtUI/QtBookmarkDetailWindow.cpp
index ea5b217..920e94e 100644
--- a/Swift/QtUI/QtBookmarkDetailWindow.cpp
+++ b/Swift/QtUI/QtBookmarkDetailWindow.cpp
@@ -13,67 +13,67 @@
namespace Swift {
QtBookmarkDetailWindow::QtBookmarkDetailWindow(QWidget* parent) : QDialog(parent) {
- setupUi(this);
- setAttribute(Qt::WA_DeleteOnClose, true);
- //connect(buttons_, SIGNAL(accepted()), SLOT(accept()));
- //connect(buttons_, SIGNAL(rejected()), SLOT(reject()));
- setFixedHeight(sizeHint().height());
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose, true);
+ //connect(buttons_, SIGNAL(accepted()), SLOT(accept()));
+ //connect(buttons_, SIGNAL(rejected()), SLOT(reject()));
+ setFixedHeight(sizeHint().height());
}
void QtBookmarkDetailWindow::accept() {
- if (commit()) {
- QDialog::accept();
- }
+ if (commit()) {
+ QDialog::accept();
+ }
}
boost::optional<MUCBookmark> QtBookmarkDetailWindow::createBookmarkFromForm() {
- //check room
- //check bookmarkName
- JID room(Q2PSTRING(room_->text()));
- if (!room.isValid() || room.getNode().empty() || !room.getResource().empty()) {
- QMessageBox::warning(this, tr("Bookmark not valid"), tr("You must specify a valid room address (e.g. someroom@rooms.example.com)."));
- return boost::optional<MUCBookmark>();
- }
- std::string name(Q2PSTRING(name_->text()));
- if (name.empty()) {
- name = room.toString();
- }
+ //check room
+ //check bookmarkName
+ JID room(Q2PSTRING(room_->text()));
+ if (!room.isValid() || room.getNode().empty() || !room.getResource().empty()) {
+ QMessageBox::warning(this, tr("Bookmark not valid"), tr("You must specify a valid room address (e.g. someroom@rooms.example.com)."));
+ return boost::optional<MUCBookmark>();
+ }
+ std::string name(Q2PSTRING(name_->text()));
+ if (name.empty()) {
+ name = room.toString();
+ }
- MUCBookmark bookmark(room, name);
- std::string nick(Q2PSTRING(nick_->text()));
- std::string password(Q2PSTRING(password_->text()));
- bookmark.setAutojoin(autojoin_->isChecked());
- if (!nick.empty()) {
- bookmark.setNick(nick);
- }
- if (!password.empty()) {
- bookmark.setPassword(password);
- }
- return bookmark;
+ MUCBookmark bookmark(room, name);
+ std::string nick(Q2PSTRING(nick_->text()));
+ std::string password(Q2PSTRING(password_->text()));
+ bookmark.setAutojoin(autojoin_->isChecked());
+ if (!nick.empty()) {
+ bookmark.setNick(nick);
+ }
+ if (!password.empty()) {
+ bookmark.setPassword(password);
+ }
+ return bookmark;
}
void QtBookmarkDetailWindow::createFormFromBookmark(const MUCBookmark& bookmark) {
- if (bookmark.getRoom().isValid()) {
- room_->setText(P2QSTRING(bookmark.getRoom().toString()));
- }
+ if (bookmark.getRoom().isValid()) {
+ room_->setText(P2QSTRING(bookmark.getRoom().toString()));
+ }
- if (!bookmark.getName().empty()) {
- name_->setText(P2QSTRING(bookmark.getName()));
- }
+ if (!bookmark.getName().empty()) {
+ name_->setText(P2QSTRING(bookmark.getName()));
+ }
- if (bookmark.getNick()) {
- nick_->setText(P2QSTRING((*bookmark.getNick())));
- }
+ if (bookmark.getNick()) {
+ nick_->setText(P2QSTRING((*bookmark.getNick())));
+ }
- if (bookmark.getPassword()) {
- password_->setText(P2QSTRING((*bookmark.getPassword())));
- }
+ if (bookmark.getPassword()) {
+ password_->setText(P2QSTRING((*bookmark.getPassword())));
+ }
- if (bookmark.getAutojoin()) {
- autojoin_->setCheckState(Qt::Checked);
- } else {
- autojoin_->setCheckState(Qt::Unchecked);
- }
+ if (bookmark.getAutojoin()) {
+ autojoin_->setCheckState(Qt::Checked);
+ } else {
+ autojoin_->setCheckState(Qt::Unchecked);
+ }
}
}