Skip to content

Commit

Permalink
Activity: Correctly restore column sizes
Browse files Browse the repository at this point in the history
Fixes: #3005
  • Loading branch information
Daniel Molkentin committed Mar 23, 2015
1 parent 4df455f commit c7eb85e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
20 changes: 14 additions & 6 deletions src/gui/protocolwidget.cpp
Expand Up @@ -73,16 +73,10 @@ ProtocolWidget::ProtocolWidget(QWidget *parent) :
_copyBtn->setToolTip( tr("Copy the activity list to the clipboard."));
_copyBtn->setEnabled(false);
connect(_copyBtn, SIGNAL(clicked()), SLOT(copyToClipboard()));

ConfigFile cfg;
cfg.restoreGeometryHeader(_ui->_treeWidget->header());
}

ProtocolWidget::~ProtocolWidget()
{
ConfigFile cfg;
cfg.saveGeometryHeader(_ui->_treeWidget->header() );

delete _ui;
}

Expand Down Expand Up @@ -137,6 +131,20 @@ void ProtocolWidget::slotRetrySync()
folderMan->slotScheduleAllFolders();
}

void ProtocolWidget::showEvent(QShowEvent *ev)
{
ConfigFile cfg;
cfg.restoreGeometryHeader(_ui->_treeWidget->header());
QWidget::showEvent(ev);
}

void ProtocolWidget::hideEvent(QHideEvent *ev)
{
ConfigFile cfg;
cfg.saveGeometryHeader(_ui->_treeWidget->header() );
QWidget::hideEvent(ev);
}

void ProtocolWidget::cleanIgnoreItems(const QString& folder)
{
int itemCnt = _ui->_treeWidget->topLevelItemCount();
Expand Down
6 changes: 4 additions & 2 deletions src/gui/protocolwidget.h
Expand Up @@ -39,8 +39,6 @@ class ProtocolWidget : public QWidget
explicit ProtocolWidget(QWidget *parent = 0);
~ProtocolWidget();

signals:

public slots:
void slotProgressInfo( const QString& folder, const Progress::Info& progress );
void slotOpenFile( QTreeWidgetItem* item, int );
Expand All @@ -49,6 +47,10 @@ protected slots:
void copyToClipboard();
void slotRetrySync();

protected:
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);

signals:
void guiLog(const QString&, const QString&);

Expand Down
4 changes: 2 additions & 2 deletions src/libsync/configfile.cpp
Expand Up @@ -147,7 +147,7 @@ void ConfigFile::saveGeometryHeader(QHeaderView *header)
{
#ifndef TOKEN_AUTH_ONLY
if(!header) return;
Q_ASSERT(!header->objectName().isNull());
Q_ASSERT(!header->objectName().isEmpty());

QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup(header->objectName());
Expand All @@ -164,7 +164,7 @@ void ConfigFile::restoreGeometryHeader(QHeaderView *header)

QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup(header->objectName());
header->restoreState(getValue(geometryC, header->objectName()).toByteArray());
header->restoreState(settings.value(geometryC).toByteArray());
#endif
}

Expand Down

0 comments on commit c7eb85e

Please sign in to comment.