Browse Source

escaping function now in utils header
automatically escaping values in the devTest logic

logicp 5 years ago
parent
commit
c4e5274536
1 changed files with 7 additions and 15 deletions
  1. 7 15
      src/argdialog.cpp

+ 7 - 15
src/argdialog.cpp

@@ -8,13 +8,7 @@
 #include <QTableWidgetItem>
 #include <QDateTime>
 #include <QCalendarWidget>
-
-static QString escapeText(QString s) {
-    if (s.contains("'")) {
-        s.replace("'", "'\"'\"'");
-    }
-    return s;
-}
+#include <headers/util.hpp>
 
 ArgDialog::ArgDialog(QWidget *parent) :
     QDialog(parent),
@@ -99,15 +93,13 @@ ArgDialog::ArgDialog(QWidget *parent) :
 
     QObject::connect(ui->devTestButton, &QPushButton::clicked, this, [this]() {
         clearPost();
-        KFile file = KFile{.name="videofile", .path="videopath"};
         m_ig_post = IGPost{
-            .description = "asdasdas",
-            .datetime = "sdasadasd",
-            .promote_share = "dfgdfg",
-            .link_in_bio = "asdasd",
-            .hashtags = {"tag1", "tag2"},
-            .requested_by = {"person"},
-            .video = file
+            .description = escapeText("My description yay!!!").toUtf8().constData(),
+            .datetime = std::to_string(QDateTime::currentDateTime().toTime_t() + 12000),
+            .promote_share = escapeText("Please promote and share ❤️").toUtf8().constData(),
+            .link_in_bio = escapeText("Link in bio!!").toUtf8().constData(),
+            .hashtags = {"love", "life"},
+            .requested_by = {"unwillingagent"}
         };
     });
 }