Fixes and improves 'copy to clipboard' output.

- With the merging of activities and notifications the copy to clipboard
function got broken. Had to put it back as it was before.
- The output text from the clipboard was almost unreadeable. Ajusted the
space between texts and used separator '-' instead of ','.
- Minor: cleans up comments.

Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
Camila San 2018-07-10 17:07:54 +02:00 committed by Roeland Jago Douma
parent 4a6b7854f5
commit 938c99ec42
No known key found for this signature in database
GPG key ID: F941078878347C0C
4 changed files with 26 additions and 49 deletions

View file

@ -95,8 +95,8 @@ ActivityWidget::ActivityWidget(AccountState *accountState, QWidget *parent)
connect(_ui->_activityList, &QListView::activated, this, &ActivityWidget::slotOpenFile);
connect(&_removeTimer, &QTimer::timeout, this, &ActivityWidget::slotCheckToCleanWidgets);
connect(ProgressDispatcher::instance(), &ProgressDispatcher::progressInfo,
this, &ActivityWidget::slotProgressInfo);
// connect(ProgressDispatcher::instance(), &ProgressDispatcher::progressInfo,
// this, &ActivityWidget::slotProgressInfo);
connect(ProgressDispatcher::instance(), &ProgressDispatcher::itemCompleted,
this, &ActivityWidget::slotItemCompleted);
connect(ProgressDispatcher::instance(), &ProgressDispatcher::syncError,
@ -111,13 +111,13 @@ ActivityWidget::~ActivityWidget()
}
// TODO
void ActivityWidget::slotProgressInfo(const QString &folder, const ProgressInfo &progress)
{
if (progress.status() == ProgressInfo::Starting) {
// The sync is restarting, clean the old items
//cleanItems(folder);
}
}
//void ActivityWidget::slotProgressInfo(const QString &folder, const ProgressInfo &progress)
//{
// if (progress.status() == ProgressInfo::Starting) {
// // The sync is restarting, clean the old items
// //cleanItems(folder);
// }
//}
void ActivityWidget::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item){
auto folderInstance = FolderMan::instance()->folder(folder);
@ -323,37 +323,32 @@ void ActivityWidget::storeActivityList(QTextStream &ts)
QString message = activity._message.isEmpty()? "Message!" : activity._message;
ts << right
// account name
<< qSetFieldWidth(30)
<< qSetFieldWidth(activity._accName.length())
<< activity._accName
// separator
<< qSetFieldWidth(0) << ","
<< qSetFieldWidth(2) << " - "
// date and time
<< qSetFieldWidth(34)
<< qSetFieldWidth(activity._dateTime.toString().length())
<< activity._dateTime.toString()
// separator
<< qSetFieldWidth(0) << ","
<< qSetFieldWidth(2) << " - "
// file
<< qSetFieldWidth(30)
// fileq
<< qSetFieldWidth(activity._file.length())
<< activity._file
// separator
<< qSetFieldWidth(0) << ","
<< qSetFieldWidth(2) << " - "
// subject
<< qSetFieldWidth(100)
<< qSetFieldWidth(activity._subject.length())
<< activity._subject
// separator
<< qSetFieldWidth(0) << ","
<< qSetFieldWidth(2) << " - "
// message
<< qSetFieldWidth(55)
<< message
// separator
<< qSetFieldWidth(0) << ","
//
<< qSetFieldWidth(0)
<< qSetFieldWidth(activity._message.length())
<< activity._message
<< endl;
}
}
@ -578,6 +573,7 @@ ActivitySettings::ActivitySettings(AccountState *accountState, QWidget *parent)
// Add a progress indicator to spin if the acitivity list is updated.
_progressIndicator = new QProgressIndicator(this);
// connect a model signal to stop the animation
connect(_activityWidget, &ActivityWidget::rowsInserted, _progressIndicator, &QProgressIndicator::stopAnimation);
connect(_activityWidget, &ActivityWidget::rowsInserted, this, &ActivitySettings::slotDisplayActivities);
@ -593,16 +589,6 @@ void ActivitySettings::setNotificationRefreshInterval(std::chrono::milliseconds
_notificationCheckTimer.start(interval.count());
}
void ActivitySettings::slotShowIssueItemCount(int cnt)
{
QString cntText = tr("Not Synced");
if (cnt) {
//: %1 is the number of not synced files.
cntText = tr("Not Synced (%1)").arg(cnt);
}
}
// TODO
void ActivitySettings::slotCopyToClipboard()
{
QString text;
@ -610,6 +596,9 @@ void ActivitySettings::slotCopyToClipboard()
QString message;
_activityWidget->storeActivityList(ts);
message = tr("The server activity and notifications list has been copied to the clipboard.");
QApplication::clipboard()->setText(text);
emit guiLog(tr("Copied to clipboard"), message);

View file

@ -77,12 +77,9 @@ public slots:
void slotRemoveAccount();
void slotAccountActivityStatus(int statusCode);
void slotRequestCleanupAndBlacklist(const Activity &blacklistActivity);
//
void addError(const QString &folderAlias, const QString &message, ErrorCategory category);
void slotProgressInfo(const QString &folder, const ProgressInfo &progress);
//void slotProgressInfo(const QString &folder, const ProgressInfo &progress);
void slotItemCompleted(const QString &folder, const SyncFileItemPtr &item);
//void slotOpenFile(QTreeWidgetItem *item, int);
signals:
void guiLog(const QString &, const QString &);
@ -150,15 +147,11 @@ public:
public slots:
void slotRefresh();
void slotRemoveAccount();
void setNotificationRefreshInterval(std::chrono::milliseconds interval);
//void slotShowIssuesTab(const QString &folderAlias);
private slots:
void slotCopyToClipboard();
void slotRegularNotificationCheck();
void slotShowIssueItemCount(int cnt);
void slotDisplayActivities();
signals:

View file

@ -253,11 +253,9 @@ void SettingsDialog::accountAdded(AccountState *s)
connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialog::slotAccountAvatarChanged);
connect(s->account().data(), &Account::accountChangedDisplayName, this, &SettingsDialog::slotAccountDisplayNameChanged);
// Refresh immediatly when getting online (?)
// Refresh immediatly when getting online
connect(s, &AccountState::isConnectedChanged, this, &SettingsDialog::slotRefreshActivityAccountStateSender);
//slotRefreshActivity(s);
activityAdded(s);
QWidget* spacer = new QWidget();
spacer->setMinimumWidth(30);

View file

@ -101,9 +101,6 @@ SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent)
accountAdded(ai.data());
}
//_actionBefore = new QAction;
//addAction(_actionBefore);
QIcon generalIcon = MacStandardIcon::icon(MacStandardIcon::PreferencesGeneral);
GeneralSettings *generalSettings = new GeneralSettings;
addPreferencesPanel(generalIcon, tr("General"), generalSettings);