diff --git a/src/lib/session/recoverywidget.cpp b/src/lib/session/recoverywidget.cpp index 4dbee3c20..8f465d834 100644 --- a/src/lib/session/recoverywidget.cpp +++ b/src/lib/session/recoverywidget.cpp @@ -39,6 +39,7 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) const RestoreManager::WindowData &wd = data.at(i); QTreeWidgetItem* root = new QTreeWidgetItem(ui->treeWidget); + root->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsTristate); root->setText(0, tr("Window %1").arg((i + 1))); root->setCheckState(0, Qt::Checked); @@ -46,6 +47,7 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) const WebTab::SavedTab &st = wd.tabsState.at(tab); QTreeWidgetItem* child = new QTreeWidgetItem(root); + child->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled); child->setCheckState(0, Qt::Checked); child->setIcon(0, st.icon); child->setText(0, st.title); @@ -54,24 +56,10 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) ui->treeWidget->expandAll(); - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onItemChanged(QTreeWidgetItem*, int))); connect(ui->restoreSession, SIGNAL(clicked()), this, SLOT(restoreSession())); connect(ui->newSession, SIGNAL(clicked()), this, SLOT(newSession())); } -void RecoveryWidget::onItemChanged(QTreeWidgetItem* item, int column) -{ - if (column != 0 || item->childCount() == 0) { - return; - } - - bool disabled = item->checkState(0) == Qt::Unchecked; - - for (int i = 0; i < item->childCount(); ++i) { - item->child(i)->setDisabled(disabled); - } -} - void RecoveryWidget::restoreSession() { RestoreManager* manager = mApp->restoreManager(); diff --git a/src/lib/session/recoverywidget.h b/src/lib/session/recoverywidget.h index 18257614a..6a1d1c65c 100644 --- a/src/lib/session/recoverywidget.h +++ b/src/lib/session/recoverywidget.h @@ -40,8 +40,6 @@ public: ~RecoveryWidget(); private slots: - void onItemChanged(QTreeWidgetItem* item, int column); - void restoreSession(); void newSession(); diff --git a/src/lib/tools/globalfunctions.cpp b/src/lib/tools/globalfunctions.cpp index 90971ccbb..0ad0992c5 100644 --- a/src/lib/tools/globalfunctions.cpp +++ b/src/lib/tools/globalfunctions.cpp @@ -382,6 +382,7 @@ QString QT_QUPZILLA_EXPORT qz_escape(const QString &string) #endif } +#ifdef QZ_WS_X11 void QT_QUPZILLA_EXPORT* qz_X11Display(const QWidget* widget) { Q_UNUSED(widget) @@ -392,6 +393,7 @@ void QT_QUPZILLA_EXPORT* qz_X11Display(const QWidget* widget) return QX11Info::display(); #endif } +#endif QString qz_buildSystem() { diff --git a/src/lib/webview/siteinfo.cpp b/src/lib/webview/siteinfo.cpp index d4dfa6f42..61d195ce1 100644 --- a/src/lib/webview/siteinfo.cpp +++ b/src/lib/webview/siteinfo.cpp @@ -34,6 +34,7 @@ #include #include #include +#include QString SiteInfo::showCertInfo(const QString &string) { @@ -50,12 +51,13 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) , ui(new Ui::SiteInfo) , m_certWidget(0) , m_view(view) + , m_delegate(0) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); - ListItemDelegate* delegate = new ListItemDelegate(24, ui->listWidget); - ui->listWidget->setItemDelegate(delegate); + m_delegate = new ListItemDelegate(24, ui->listWidget); + ui->listWidget->setItemDelegate(m_delegate); ui->listWidget->item(0)->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/preferences/document-properties.png"))); ui->listWidget->item(1)->setIcon(QIcon::fromTheme("applications-graphics", QIcon(":/icons/preferences/applications-graphics.png"))); @@ -63,8 +65,6 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) ui->listWidget->item(3)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png"))); ui->listWidget->item(0)->setSelected(true); - ui->listWidget->setFixedHeight(delegate->itemHeight()); - WebPage* webPage = view->page(); QWebFrame* frame = view->page()->mainFrame(); QString title = view->title(); @@ -175,6 +175,8 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) ui->treeImages->sortByColumn(-1); ui->treeTags->sortByColumn(-1); + + QTimer::singleShot(0, this, SLOT(heightChange())); } void SiteInfo::imagesCustomContextMenuRequested(const QPoint &p) @@ -245,6 +247,13 @@ void SiteInfo::downloadImage() } } +void SiteInfo::heightChange() +{ + if (m_delegate) { + ui->listWidget->setFixedHeight(m_delegate->itemHeight()); + } +} + void SiteInfo::showImagePreview(QTreeWidgetItem* item) { if (!item) { diff --git a/src/lib/webview/siteinfo.h b/src/lib/webview/siteinfo.h index b8f2f775d..a55fea0a2 100644 --- a/src/lib/webview/siteinfo.h +++ b/src/lib/webview/siteinfo.h @@ -33,6 +33,7 @@ class QTreeWidgetItem; class WebView; class CertificateInfoWidget; +class ListItemDelegate; class QT_QUPZILLA_EXPORT SiteInfo : public QDialog { @@ -52,11 +53,13 @@ private slots: void imagesCustomContextMenuRequested(const QPoint &p); void copyActionData(); void downloadImage(); + void heightChange(); private: Ui::SiteInfo* ui; CertificateInfoWidget* m_certWidget; WebView* m_view; + ListItemDelegate* m_delegate; QPixmap m_activePixmap; QUrl m_baseUrl;