Browse Source

Removed old account toolbox

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Dominique Fuchs 6 years ago
parent
commit
163ca3b58a
4 changed files with 4 additions and 84 deletions
  1. 3 72
      src/gui/accountsettings.cpp
  2. 0 3
      src/gui/accountsettings.h
  3. 1 8
      src/gui/accountsettings.ui
  4. 0 1
      src/gui/systray.cpp

+ 3 - 72
src/gui/accountsettings.cpp

@@ -143,9 +143,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
     _ui->_folderList->setAttribute(Qt::WA_Hover, true);
     _ui->_folderList->installEventFilter(mouseCursorChanger);
 
-    createAccountToolbox();
-    connect(AccountManager::instance(), &AccountManager::accountAdded,
-        this, &AccountSettings::slotAccountAdded);
     connect(this, &AccountSettings::removeAccountFolders,
             AccountManager::instance(), &AccountManager::removeAccountFolders);
     connect(_ui->_folderList, &QWidget::customContextMenuRequested,
@@ -211,37 +208,10 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
         _ui->encryptionMessage->hide();
     }
 
-    customizeStyle();
-}
-
-
-void AccountSettings::createAccountToolbox()
-{
-    QMenu *menu = new QMenu();
-
-    connect(menu, &QMenu::aboutToShow, this, &AccountSettings::slotMenuBeforeShow);
-
-    _addAccountAction = new QAction(tr("Add new"), this);
-    menu->addAction(_addAccountAction);
-    
-    connect(_addAccountAction, &QAction::triggered, this, &AccountSettings::slotOpenAccountWizard);
     connect(UserModel::instance(), &UserModel::addAccount,
-        this, &AccountSettings::slotOpenAccountWizard);
-
-    _toggleSignInOutAction = new QAction(tr("Log out"), this);
-    connect(_toggleSignInOutAction, &QAction::triggered, this, &AccountSettings::slotToggleSignInState);
-    menu->addAction(_toggleSignInOutAction);
+         this, &AccountSettings::slotOpenAccountWizard);
 
-    QAction *action = new QAction(tr("Remove"), this);
-    menu->addAction(action);
-
-    connect(action, &QAction::triggered, this, &AccountSettings::slotDeleteAccount);
-
-    _ui->_accountToolbox->setText(tr("Account") + QLatin1Char(' '));
-    _ui->_accountToolbox->setMenu(menu);
-    _ui->_accountToolbox->setPopupMode(QToolButton::InstantPopup);
-
-    slotAccountAdded(_accountState);
+    customizeStyle();
 }
 
 
@@ -257,24 +227,6 @@ void AccountSettings::slotNewMnemonicGenerated()
     _ui->encryptionMessage->show();
 }
 
-void AccountSettings::slotMenuBeforeShow() {
-    if (_menuShown) {
-        return;
-    }
-
-    auto menu = _ui->_accountToolbox->menu();
-
-    // We can't check this during the initial creation as there is no account yet then
-    if (_accountState->account()->capabilities().clientSideEncryptionAvaliable()) {
-        QAction *mnemonic = new QAction(tr("Show E2E mnemonic"), this);
-        connect(mnemonic, &QAction::triggered, this, &AccountSettings::requesetMnemonic);
-        menu->addAction(mnemonic);
-    }
-
-    _menuShown = true;
-}
-
-
 QString AccountSettings::selectedFolderAlias() const
 {
     QModelIndex selected = _ui->_folderList->selectionModel()->currentIndex();
@@ -1068,21 +1020,12 @@ void AccountSettings::slotAccountStateChanged()
     // sync user interface buttons.
     refreshSelectiveSyncStatus();
 
-    /* set the correct label for the Account toolbox button */
-    if (_accountState) {
-        if (_accountState->isSignedOut()) {
-            _toggleSignInOutAction->setText(tr("Log in"));
-        } else {
-            _toggleSignInOutAction->setText(tr("Log out"));
-        }
-    }
-
     if (state == AccountState::State::Connected) {
         /* TODO: We should probably do something better here.
          * Verify if the user has a private key already uploaded to the server,
          * if it has, do not offer to create one.
          */
-        qCInfo(lcAccountSettings) << "Accout" << accountsState()->account()->displayName()
+        qCInfo(lcAccountSettings) << "Account" << accountsState()->account()->displayName()
             << "Client Side Encryption" << accountsState()->account()->capabilities().clientSideEncryptionAvaliable();
     }
 }
@@ -1198,18 +1141,6 @@ void AccountSettings::refreshSelectiveSyncStatus()
     }
 }
 
-void AccountSettings::slotAccountAdded(AccountState *)
-{
-    // if the theme is limited to single account, the button must hide if
-    // there is already one account.
-    int s = AccountManager::instance()->accounts().size();
-    if (s > 0 && !Theme::instance()->multiAccount()) {
-        _addAccountAction->setVisible(false);
-    } else {
-        _addAccountAction->setVisible(true);
-    }
-}
-
 void AccountSettings::slotDeleteAccount()
 {
     // Deleting the account potentially deletes 'this', so

+ 0 - 3
src/gui/accountsettings.h

@@ -90,7 +90,6 @@ protected slots:
     void slotDeleteAccount();
     void slotToggleSignInState();
     void slotOpenAccountWizard();
-    void slotAccountAdded(AccountState *);
     void refreshSelectiveSyncStatus();
     void slotMarkSubfolderEncrypted(const FolderStatusModel::SubFolderInfo* folderInfo);
     void slotMarkSubfolderDecrypted(const FolderStatusModel::SubFolderInfo* folderInfo);
@@ -100,8 +99,6 @@ protected slots:
     void doExpand();
     void slotLinkActivated(const QString &link);
 
-    void slotMenuBeforeShow();
-
     // Encryption Related Stuff.
     void slotShowMnemonic(const QString &mnemonic);
     void slotNewMnemonicGenerated();

+ 1 - 8
src/gui/accountsettings.ui

@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>516</width>
+    <width>581</width>
     <height>557</height>
    </rect>
   </property>
@@ -184,13 +184,6 @@
         </property>
        </widget>
       </item>
-      <item row="0" column="2">
-       <widget class="QToolButton" name="_accountToolbox">
-        <property name="text">
-         <string notr="true">...</string>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>

+ 0 - 1
src/gui/systray.cpp

@@ -79,7 +79,6 @@ void Systray::create()
 void Systray::slotChangeActivityModel()
 {
     _trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel());
-    //UserModel::instance()->currentActivityModel()->slotRefreshActivity();
 }
 
 bool Systray::isOpen()