From 6c4a7ace8766a9bf70d3f14cfaa153ff0d670365 Mon Sep 17 00:00:00 2001 From: xavierqet Date: Sat, 3 Nov 2007 20:20:34 +0000 Subject: [PATCH] Activation/desactivation de l'action "Coller ici" en fonction de l'etat du presse-papier Mise a jour des traductions git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@203 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- diagram.cpp | 7 +++ diagram.h | 9 ++-- diagramview.cpp | 1 + lang/qet_en.qm | Bin 50482 -> 50552 bytes lang/qet_en.ts | 110 +++++++++++++++++++++++-------------------- qetdiagrameditor.cpp | 9 +--- 6 files changed, 74 insertions(+), 62 deletions(-) diff --git a/diagram.cpp b/diagram.cpp index 4f02d26b5..7383199d8 100644 --- a/diagram.cpp +++ b/diagram.cpp @@ -595,3 +595,10 @@ QSet Diagram::selectedConductors() const { } return(conductors_set); } + +/// @return true si le presse-papier semble contenir un schema +bool Diagram::clipboardMayContainDiagram() { + QString clipboard_text = QApplication::clipboard() -> text().trimmed(); + bool may_be_diagram = clipboard_text.startsWith(""); + return(may_be_diagram); +} diff --git a/diagram.h b/diagram.h index d013721d2..e041ccdfd 100644 --- a/diagram.h +++ b/diagram.h @@ -62,10 +62,13 @@ class Diagram : public QGraphicsScene { bool draw_terminals; // methodes + protected: + virtual void drawBackground(QPainter *, const QRectF &); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + public: - void drawBackground(QPainter *, const QRectF &); - void keyPressEvent(QKeyEvent *); - void keyReleaseEvent(QKeyEvent *); + static bool clipboardMayContainDiagram(); // fonctions relatives a la pose de conducteurs void setConductor(bool); diff --git a/diagramview.cpp b/diagramview.cpp index 8586794b7..43de3f93d 100644 --- a/diagramview.cpp +++ b/diagramview.cpp @@ -826,6 +826,7 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) { context_menu -> clear(); if (scene -> selectedItems().isEmpty()) { paste_here_pos = e -> pos(); + paste_here -> setEnabled(Diagram::clipboardMayContainDiagram()); context_menu -> addAction(paste_here); context_menu -> addSeparator(); context_menu -> addAction(qde -> infos_diagram); diff --git a/lang/qet_en.qm b/lang/qet_en.qm index 34d1302582c5a0bdd067ec8dd62da00f18f6692a..30f686d02bf0f84f86b507305a7b7f54db31fdec 100644 GIT binary patch delta 3272 zcmXZecU%`lagRhbow^*sN-($s@Aqr8;w$pqJ{;za61b_0Bs7cBr~6FB93`H#;~` zJ)-YRqQMu`<95an4H>JRl%RvV6kn-l{M1hL*;KXPfJS&#?LRAt=<_KC_5Aw{L__1$ z^BlW6r{3M-g}6>#7FI_zJY8MWh|GpRRUbXh5ZO&qKk9QF z)~h=`k+6LyBUQB#jYwwne0TUeW61;%jr3)#bBbUkV}AwDI~WEsp2giTh+_g?VNX+p#lgOET%dBp}gQM)3_5Sg2F|#-8HarOL!#4OAk&^^b z5hoAW30EkVz_*BRz`uzM&OI=AN8~(}*_&+vQxz+q3URyHFZx0x_=Pu9{&Wb;P&~&p zMa*>1m#AR6t@_H;`m8soFxY{DOHL>>&g z+?1flY}UAPJbY%>GnmcRpaPy(*$wWv{^e@6aG5=P!xoK?Cz@!_7Nu^3X>9RCYj~O6 zehWP@$&xM4GuUGAD_b#XDbeKqY}LUExPYxgqBOZ!@v7M=AF`**umw}R*efGaVHNwE zRWtmPy*U6cm>SAm_gjMMfg8ST3v*iFws> zQLQtGW~sTvUWZ^hw}Ml{liW)CU*T&m*%e#k?aHM@q6fU!a)yj5oOACwF3aH*e8S~A zMG?(*;_^}-z^&XCBT6>=idi2GS3Kb*k&hF%=e;kC;>x>BR&qy6B47u1B{+r1cQ|*e z+eVnfJqr04{*QZP$RhIll-F#}hsSs+Vgu0}D+Ay2cq;}o`Fte)Tb*vK)zgHJ8uGu_FpH4B@kGjKd&^&*`}j9^!NUjbHE^O!555{7wOt znV+b5Q1LClTaC&ra951rD~9ezyoEp9f*x4V!8a$?5(Rtmmj*b%QvQ-17P!!YZ%;x3 z3zzZt-Q#fnLjw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p9&MiB3pl0A=asMIRCruis#SmBidaqwhl^y zonqTxXqxYbiFddk;R^Bhn>Y>M9~FD{AoF}H@kOi}J`j6B1`IB0r{cgGw`#y$^y5F{7kBdWecj6*pk?!8lSYdI$ z?taoZq5~^si*)z<79jpz_qXx;2VEpHCFVaECJoe^brK!YNJD?Khm9snSjo8onU>6v z+@IpXC0C`1KeQ7awvdgJJa%Hj!yS_6ZCo#nmAv}K6P2kYza#z7Tl#E1UQFedQrKxE zRK7(DyR0IrcwdUiSHOi*%yn~Uko57^$fTl4O6I$XDz{20;l8j#T0a2^REJ5MBJ*?qQO&1P-Xsf{B2|_p!n0CkWj_2{x@f@G9T_D(+Z+MIq`pBDVWsrut*`M@S36%x iL<+J)vk + AboutQET @@ -226,115 +227,120 @@ DiagramView - + ? ? - + Auteur : Author : - + Date : Date : - + Enregistrer le schéma en cours ? Save the current diagram ? - + Enregistrer sous Save as - + Erreur Error - + Fichier : File : - + Folio : Folio : - + Impossible d'ecrire dans ce fichier Can't write to the file - + Schéma QElectroTech (*.qet) QElectroTech Diagram (*.qet) - + Titre : Title : - + Voulez-vous enregistrer le schéma Do you wish to save the diagram - + nouveau schéma new diagram - + Éditer les propriétés d'un conducteur Edit conductor properties - + Propriétés du schéma Diagram properties - + Dimensions du schéma Diagram size - + Colonnes : Columns : - + × × - + px px - + Hauteur : Height : - + Informations du cartouche Inset properties - + Éditer les propriétés par défaut des conducteurs Edit conductors default properties + + + Coller ici + Paste Here + ElementDeleter @@ -557,22 +563,22 @@ Please check rights of the directory ElementsPanel - + Ceci est un élément que vous pouvez insérer dans votre schéma par cliquer-déplacer This is an element you can drag'n drop onto your diagram - + Cliquer-déposez cet élément sur le schéma pour insérer un élément Drag'n drop this element to the diagram to insert a - + Collection QET QET Collection - + Collection utilisateur User Collection @@ -615,12 +621,12 @@ Please check rights of the directory Delete element - + Gestionnaire de catégories Categories manager - + Vous pouvez utiliser ce gestionnaire pour ajouter, supprimer ou modifier les catégories. Use this manager to add, delete or modify categories. @@ -1147,22 +1153,22 @@ Please check rights of the directory Restore QElectroTech - + Éditeurs de schémas Diagram editors - + Éditeurs d'élément Element editors - + Usage : Usage: - + QElectroTech, une application de réalisation de schémas électriques. Options disponibles : @@ -1179,7 +1185,7 @@ Available options: - + [options] [fichier]... @@ -1188,7 +1194,7 @@ Available options: - + --common-elements-dir=DIR Definir le dossier de la collection d'elements --common-elements-dir=DIR Define the elements collection directory @@ -1198,7 +1204,7 @@ Available options: QETDiagramEditor - + Active la fenêtre Activates the window @@ -1233,7 +1239,7 @@ Available options: Displays informations about QElectroTech - + Affiche ou non le panel d'appareils Displays or not the elements panel @@ -1313,12 +1319,12 @@ Available options: &Cascade - + Ce fichier n'est pas un document XML valide. This file is not a valid XML Document. - + Ce fichier n'existe pas. This file does not exist. @@ -1473,7 +1479,7 @@ Available options: Save as - + Erreur Error @@ -1533,7 +1539,7 @@ Available options: Imports a plan into the current plan - + Impossible de lire ce fichier. Could not read file. @@ -1573,7 +1579,7 @@ Available options: &New - + Outils Tools @@ -1588,7 +1594,7 @@ Available options: &Open - + Ouvrir un fichier Open a file @@ -1673,7 +1679,7 @@ Available options: Shrink the diagram's height - + Schémas QElectroTech (*.qet);;Fichiers XML (*.xml);;Tous les fichiers (*) QElectroTech Diagrams (*.qet);;XML Files (*.xml);;All files (*) @@ -1703,7 +1709,7 @@ Available options: Puts selected elements into the clipboard - + Une erreur s'est produite lors de l'ouverture du fichier. An error occured while opening the file. @@ -1778,27 +1784,27 @@ Available options: Reset the conductors path ignoring the user changes - + Affiche ou non la barre d'outils principale Display or hide the main toolbar - + Affiche ou non la barre d'outils Affichage Display or hide the Display toolbar - + Affiche ou non la barre d'outils Schéma Display or hide the Diagram toolbar - + Affichage Display - + Schéma Diagram @@ -2219,17 +2225,17 @@ Available options: terminal - + T T - + texte text - + _ _ diff --git a/qetdiagrameditor.cpp b/qetdiagrameditor.cpp index 6efe1ad9d..889a41cd2 100644 --- a/qetdiagrameditor.cpp +++ b/qetdiagrameditor.cpp @@ -777,13 +777,8 @@ void QETDiagramEditor::slot_updateModeActions() { Gere les actions ayant besoin du presse-papier */ void QETDiagramEditor::slot_updatePasteAction() { - if (!currentDiagram()) { - paste -> setEnabled(false); - } else { - QString clipboard_text = QApplication::clipboard() -> text(); - bool can_paste = clipboard_text.startsWith("\n"); - paste -> setEnabled(can_paste); - } + // pour coller, il faut un schema ouvert et un schema dans le presse-papier + paste -> setEnabled(currentDiagram() && Diagram::clipboardMayContainDiagram()); } /**