Skip to content

Commit

Permalink
Alert when deleting last profile. By @bastiencyr. (#1006)
Browse files Browse the repository at this point in the history
Fixes #918
  • Loading branch information
bastiencyr authored Jun 4, 2021
1 parent 0bdcb57 commit 0862c82
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/vorta/views/main_window.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from PyQt5 import QtCore, uic
from PyQt5.QtWidgets import QShortcut, QMessageBox, QCheckBox
from PyQt5.QtCore import QPoint
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QShortcut, QMessageBox, QCheckBox, QToolTip

from vorta.borg.borg_thread import BorgThread
from vorta.models import BackupProfileModel, SettingsModel
from vorta.utils import borg_compat, get_asset, is_system_tray_available, get_network_status_monitor
from vorta.views.utils import get_colored_icon
from vorta.views.partials.loading_button import LoadingButton

from vorta.views.utils import get_colored_icon
from .archive_tab import ArchiveTab
from .misc_tab import MiscTab
from .profile_add_edit_dialog import AddProfileWindow, EditProfileWindow
Expand Down Expand Up @@ -155,6 +155,11 @@ def profile_delete_action(self):
self.profileSelector.removeItem(self.profileSelector.currentIndex())
self.profile_select_action(0)

else:
warn = self.tr("Can't delete the last profile.")
point = QPoint(0, self.profileDeleteButton.size().height() / 2)
QToolTip.showText(self.profileDeleteButton.mapToGlobal(point), warn)

def profile_add_action(self):
window = AddProfileWindow()
self.window = window # For tests
Expand Down

0 comments on commit 0862c82

Please sign in to comment.