[X2Go-Commits] [x2goclient] 02/10: src/onmainwindow.{cpp, h}: add new function key_type_to_string ().

git-admin at x2go.org git-admin at x2go.org
Sat Sep 24 23:25:26 CEST 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 324fbf84c4af9dbdc0968bb4bbd48f5ca80d7d19
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Sep 24 04:13:08 2016 +0200

    src/onmainwindow.{cpp,h}: add new function key_type_to_string ().
    
    Returns a stringified version of the selected key type, after checking
    for validity.
---
 debian/changelog     |    3 +++
 src/onmainwindow.cpp |   24 ++++++++++++++++++++++++
 src/onmainwindow.h   |    1 +
 3 files changed, 28 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7daa786..d0956fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -408,6 +408,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       (), then wait up to 5 seconds, then via kill ().
     - src/onmainwindow.{cpp,h}: add new function check_key_type (). Takes a
       key type and checks for validity/if it's known.
+    - src/onmainwindow.{cpp,h}: add new function key_type_to_string ().
+      Returns a stringified version of the selected key type, after checking
+      for validity.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Mon, 19 Sep 2016 09:07:07 +0200
 
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index b6c580c..e1be3aa 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10250,6 +10250,30 @@ ONMainWindow::key_types ONMainWindow::check_key_type (ONMainWindow::key_types ke
   return (ret);
 }
 
+QString ONMainWindow::key_type_to_string (ONMainWindow::key_types key_type) {
+  ONMainWindow::key_types sanitized_key_type = check_key_type (key_type);
+  QString ret ("");
+
+  switch (sanitized_key_type) {
+    case RSA_KEY_TYPE:
+                           ret = "rsa";
+                           break;
+    case DSA_KEY_TYPE:
+                           ret = "dsa";
+                           break;
+    case ECDSA_KEY_TYPE:
+                           ret = "ecdsa";
+                           break;
+    case ED25519_KEY_TYPE:
+                           ret = "ed25519";
+                           break;
+    default:
+                           ret = "unknown";
+  }
+
+  return (ret);
+}
+
 QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key)
 {
     ONMainWindow::key_types sanitized_key_type = UNKNOWN_KEY_TYPE;
diff --git a/src/onmainwindow.h b/src/onmainwindow.h
index 9919fde..3d25091 100644
--- a/src/onmainwindow.h
+++ b/src/onmainwindow.h
@@ -1218,6 +1218,7 @@ private:
 #endif
 
     key_types check_key_type (key_types key_type);
+    QString key_type_to_string (key_types key_type);
 
 ////////////////plugin stuff////////////////////
 #ifdef CFGPLUGIN

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list