Kein PW bei Export
Dieser Commit ist enthalten in:
@ -1,7 +1,7 @@
|
||||
"""
|
||||
Erfolgs-Dialog für Profil-Export
|
||||
|
||||
Zeigt exportierte Dateien und optional das generierte Passwort an.
|
||||
Zeigt exportierte Dateien an.
|
||||
"""
|
||||
|
||||
import os
|
||||
@ -9,11 +9,11 @@ import logging
|
||||
import subprocess
|
||||
import platform
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
from typing import List
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton,
|
||||
QFrame, QGraphicsDropShadowEffect, QApplication, QScrollArea, QWidget
|
||||
QFrame, QGraphicsDropShadowEffect, QScrollArea, QWidget
|
||||
)
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QFont, QColor
|
||||
@ -28,8 +28,7 @@ class ExportSuccessDialog(QDialog):
|
||||
self,
|
||||
parent=None,
|
||||
exported_files: List[str] = None,
|
||||
export_directory: str = "",
|
||||
password: Optional[str] = None
|
||||
export_directory: str = ""
|
||||
):
|
||||
"""
|
||||
Initialisiert den Erfolgs-Dialog.
|
||||
@ -38,12 +37,10 @@ class ExportSuccessDialog(QDialog):
|
||||
parent: Parent-Widget
|
||||
exported_files: Liste der exportierten Dateinamen
|
||||
export_directory: Verzeichnis wo Dateien gespeichert wurden
|
||||
password: Optional generiertes Passwort (nur bei Passwortschutz)
|
||||
"""
|
||||
super().__init__(parent)
|
||||
self.exported_files = exported_files or []
|
||||
self.export_directory = export_directory
|
||||
self.password = password
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
@ -55,10 +52,8 @@ class ExportSuccessDialog(QDialog):
|
||||
self.setAttribute(Qt.WA_TranslucentBackground, True)
|
||||
self.setModal(True)
|
||||
|
||||
# Dynamische Höhe basierend auf Inhalt
|
||||
# Dynamische Höhe basierend auf Anzahl der Dateien
|
||||
base_height = 280
|
||||
if self.password:
|
||||
base_height += 80 # Extra Platz für Passwort-Anzeige
|
||||
if len(self.exported_files) > 2:
|
||||
base_height += 20 * (len(self.exported_files) - 2) # Extra für mehr Dateien
|
||||
|
||||
@ -153,72 +148,6 @@ class ExportSuccessDialog(QDialog):
|
||||
|
||||
container_layout.addWidget(scroll_area)
|
||||
|
||||
# Passwort-Anzeige (nur wenn Passwort vorhanden)
|
||||
if self.password:
|
||||
password_frame = QFrame()
|
||||
password_frame.setStyleSheet("""
|
||||
QFrame {
|
||||
background-color: #FEF3C7;
|
||||
border: 1px solid #FCD34D;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
}
|
||||
""")
|
||||
password_layout = QVBoxLayout(password_frame)
|
||||
password_layout.setSpacing(8)
|
||||
|
||||
# Warnung
|
||||
warning_label = QLabel("⚠ Bitte Passwort speichern!")
|
||||
warning_label.setStyleSheet("""
|
||||
color: #92400E;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
""")
|
||||
|
||||
# Passwort mit Copy-Button
|
||||
password_row = QHBoxLayout()
|
||||
password_row.setSpacing(10)
|
||||
|
||||
password_label = QLabel(f"🔒 Passwort: {self.password}")
|
||||
password_label.setStyleSheet("""
|
||||
color: #78350F;
|
||||
font-size: 13px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-weight: 600;
|
||||
""")
|
||||
password_label.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||
|
||||
copy_button = QPushButton("Kopieren")
|
||||
copy_button.setMaximumWidth(80)
|
||||
copy_button.setMinimumHeight(28)
|
||||
copy_button.setCursor(Qt.PointingHandCursor)
|
||||
copy_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #F59E0B;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #D97706;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #B45309;
|
||||
}
|
||||
""")
|
||||
copy_button.clicked.connect(self.copy_password)
|
||||
|
||||
password_row.addWidget(password_label, 1)
|
||||
password_row.addWidget(copy_button)
|
||||
|
||||
password_layout.addWidget(warning_label)
|
||||
password_layout.addLayout(password_row)
|
||||
|
||||
container_layout.addWidget(password_frame)
|
||||
|
||||
# Speicherort
|
||||
location_label = QLabel(f"Gespeichert in:")
|
||||
location_label.setStyleSheet("color: #6B7280; font-size: 12px;")
|
||||
@ -299,30 +228,6 @@ class ExportSuccessDialog(QDialog):
|
||||
# Container zum Hauptlayout hinzufügen
|
||||
main_layout.addWidget(self.container)
|
||||
|
||||
def copy_password(self):
|
||||
"""Kopiert das Passwort in die Zwischenablage"""
|
||||
if self.password:
|
||||
clipboard = QApplication.clipboard()
|
||||
clipboard.setText(self.password)
|
||||
logger.info("Passwort in Zwischenablage kopiert")
|
||||
|
||||
# Kurzes visuelles Feedback
|
||||
sender = self.sender()
|
||||
if sender:
|
||||
original_text = sender.text()
|
||||
sender.setText("✓ Kopiert!")
|
||||
sender.setStyleSheet(sender.styleSheet().replace("#F59E0B", "#10B981"))
|
||||
|
||||
# Nach 2 Sekunden zurücksetzen
|
||||
from PyQt5.QtCore import QTimer
|
||||
QTimer.singleShot(2000, lambda: self._reset_copy_button(sender, original_text))
|
||||
|
||||
def _reset_copy_button(self, button, original_text):
|
||||
"""Setzt den Copy-Button zurück"""
|
||||
if button:
|
||||
button.setText(original_text)
|
||||
button.setStyleSheet(button.styleSheet().replace("#10B981", "#F59E0B"))
|
||||
|
||||
def open_folder(self):
|
||||
"""Öffnet den Export-Ordner im Datei-Explorer"""
|
||||
if not self.export_directory or not os.path.exists(self.export_directory):
|
||||
@ -373,8 +278,7 @@ class ExportSuccessDialog(QDialog):
|
||||
def show_export_success(
|
||||
parent,
|
||||
exported_files: List[str],
|
||||
export_directory: str,
|
||||
password: Optional[str] = None
|
||||
export_directory: str
|
||||
):
|
||||
"""
|
||||
Zeigt den Export-Erfolgs-Dialog modal an.
|
||||
@ -383,7 +287,6 @@ def show_export_success(
|
||||
parent: Parent-Widget
|
||||
exported_files: Liste der exportierten Dateinamen
|
||||
export_directory: Verzeichnis wo Dateien gespeichert wurden
|
||||
password: Optional generiertes Passwort
|
||||
"""
|
||||
dialog = ExportSuccessDialog(parent, exported_files, export_directory, password)
|
||||
dialog = ExportSuccessDialog(parent, exported_files, export_directory)
|
||||
dialog.exec_()
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren