summaryrefslogtreecommitdiff
path: root/libre/octopi/parabola-support.patch
blob: 77b62be8f3259ccf6ead2c0f94a31d5ee9825794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
From 0e215b619b32e58089cae01ecf4db5fa79f33664 Mon Sep 17 00:00:00 2001
From: Alexandre Arnt <falso@correio.com>
Date: Sat, 11 Jul 2015 18:13:51 -0300
Subject: [PATCH] - Added Parabola GNU/Linux-libre support (thanks to coadde).

---
 src/mainwindow_news.cpp |  5 +++++
 src/package.cpp         |  3 ++-
 src/strconstants.h      | 15 ++++++++++++++-
 src/unixcommand.cpp     |  4 ++++
 src/unixcommand.h       |  2 +-
 src/utils.cpp           | 13 ++++++++++++-

diff --git a/src/mainwindow_news.cpp b/src/mainwindow_news.cpp
index da54e30..e5be94b 100644
--- a/src/mainwindow_news.cpp
+++ b/src/mainwindow_news.cpp
@@ -83,6 +83,11 @@ void MainWindow::refreshDistroNews(bool searchForLatestNews, bool gotoNewsTab)
       writeToTabOutputExt("<b>" +
                           StrConstants::getSearchingForDistroNews().arg("Netrunner Rolling") + "</b>");
     }
+    else if (gotoNewsTab && distro == ectn_PARABOLA)
+    {
+      writeToTabOutputExt("<b>" +
+                          StrConstants::getSearchingForDistroNews().arg("Parabola GNU/Linux-libre") + "</b>");
+    }
 
     /*
      * Here, we retrieve distro's latest news without
diff --git a/src/package.cpp b/src/package.cpp
index 9815e10..c5014db 100644
--- a/src/package.cpp
+++ b/src/package.cpp
@@ -1178,7 +1178,8 @@ QStringList Package::getContents(const QString& pkgName, bool isInstalled)
   else if (UnixCommand::getLinuxDistro() == ectn_ARCHBANGLINUX ||
            UnixCommand::getLinuxDistro() == ectn_ARCHLINUX ||
            UnixCommand::getLinuxDistro() == ectn_KAOS ||
-           UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX)
+           UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX ||
+           UnixCommand::getLinuxDistro() == ectn_PARABOLA)
   {
     result = UnixCommand::getPackageContentsUsingPkgfile(pkgName);
   }
diff --git a/src/strconstants.h b/src/strconstants.h
index 20de4b3..3f6f1ab 100644
--- a/src/strconstants.h
+++ b/src/strconstants.h
@@ -60,6 +60,9 @@ class StrConstants{
     if (UnixCommand::getLinuxDistro() == ectn_KAOS)
       return QLatin1String( "KCP" );
 
+    if (UnixCommand::getLinuxDistro() == ectn_PARABOLA)
+      return QLatin1String( "Custom" );
+
     return QLatin1String( "AUR" );
   }
 
@@ -68,6 +71,8 @@ class StrConstants{
       return QLatin1String( "ccr" );
     else if (UnixCommand::getLinuxDistro() == ectn_KAOS)
       return QLatin1String( "kcp" );
+    else if (UnixCommand::getLinuxDistro() == ectn_PARABOLA)
+      return QLatin1String( "custom" );
 
     return QLatin1String( "aur" );
   }
@@ -100,6 +105,8 @@ class StrConstants{
       return QLatin1String( "Ccr" );
     else if (UnixCommand::getLinuxDistro() == ectn_KAOS)
       return QLatin1String( "KCP" );
+    else if (UnixCommand::getLinuxDistro() == ectn_PARABOLA)
+      return QLatin1String( "Custom" );
 
     return QLatin1String( "AUR" );
   }
@@ -110,6 +117,8 @@ class StrConstants{
       return QLatin1String( "ccr/" );
     else if (UnixCommand::getLinuxDistro() == ectn_KAOS)
       return "kcp/";
+    else if (UnixCommand::getLinuxDistro() == ectn_PARABOLA)
+      return "custom/";
 
     return QLatin1String( "aur/" );
   }
@@ -142,12 +151,16 @@ class StrConstants{
     return QObject::tr("Netrunner Rolling news");
   }
 
+  static QString getParabolaNews(){
+    return QObject::tr("Parabola GNU/Linux-libre news");
+  }
+
   static QString getNewsErrorMessage(){
     return QObject::tr("No news could be found! Press Ctrl+G to download the latest news.");
   }
 
   static QString getIncompatibleLinuxDistroError(){
-    return QObject::tr("This Linux distro seems to be incompatible with Octopi!");
+    return QObject::tr("This GNU/Linux distro seems to be incompatible with Octopi!");
   }
 
   static QString getInternetUnavailableError(){
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index 5c2d9e9..43e0fbf 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -1036,6 +1036,10 @@ LinuxDistro UnixCommand::getLinuxDistro()
       {
         ret = ectn_NETRUNNER;
       }
+      else if (contents.contains(QRegExp("Parabola GNU/Linux-libre")))
+      {
+        ret = ectn_PARABOLA;
+      }
       else
       {
         ret = ectn_UNKNOWN;
diff --git a/src/unixcommand.h b/src/unixcommand.h
index 3a33754..1fda5be 100644
--- a/src/unixcommand.h
+++ b/src/unixcommand.h
@@ -37,7 +37,7 @@ enum CommandExecuting { ectn_NONE, ectn_MIRROR_CHECK, ectn_SYNC_DATABASE,
                         ectn_RUN_IN_TERMINAL };
 
 enum LinuxDistro { ectn_ANTERGOS, ectn_ARCHBANGLINUX, ectn_ARCHBSD, ectn_ARCHLINUX, ectn_CHAKRA,
-                   ectn_KAOS, ectn_MANJAROLINUX, ectn_MOOOSLINUX, ectn_NETRUNNER, ectn_UNKNOWN };
+                   ectn_KAOS, ectn_MANJAROLINUX, ectn_MOOOSLINUX, ectn_NETRUNNER, ectn_PARABOLA, ectn_UNKNOWN };
 
 enum Language { ectn_LANG_ENGLISH, ectn_LANG_USER_DEFINED };
 
diff --git a/src/utils.cpp b/src/utils.cpp
index 30ca38e..2c82811 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -278,6 +278,7 @@ QString utils::retrieveDistroNews(bool searchForLatestNews)
   //const QString ctn_MANJARO_LINUX_RSS_URL = "http://manjaro.org/feed/";
   const QString ctn_MANJARO_LINUX_RSS_URL = "https://manjaro.github.io/feed.xml";
   const QString ctn_NETRUNNER_RSS_URL = "http://www.netrunner-os.com/feed/";
+  const QString ctn_PARABOLA_RSS_URL = "https://www.parabola.nu/feeds/news/";
 
   LinuxDistro distro = UnixCommand::getLinuxDistro();
   QString res;
@@ -295,7 +296,7 @@ QString utils::retrieveDistroNews(bool searchForLatestNews)
   }
 
   if(searchForLatestNews && UnixCommand::hasInternetConnection() && distro != ectn_UNKNOWN)
-  {
+  {    
     QString curlCommand = "curl %1 -o %2";
 
     if (distro == ectn_ANTERGOS)
@@ -326,6 +327,12 @@ QString utils::retrieveDistroNews(bool searchForLatestNews)
     {
       curlCommand = curlCommand.arg(ctn_NETRUNNER_RSS_URL).arg(tmpRssPath);
     }
+    else if (distro == ectn_PARABOLA)
+    {
+      //Parabola has a certificate which is not "trusted" by default, so we use "curl -k"
+      curlCommand = "curl -k %1 -o %2";
+      curlCommand = curlCommand.arg(ctn_PARABOLA_RSS_URL).arg(tmpRssPath);
+    }
 
     if (UnixCommand::runCurlCommand(curlCommand).isEmpty())
     {
@@ -438,6 +445,10 @@ QString utils::parseDistroNews()
   {
     html = "<p align=\"center\"><h2>" + StrConstants::getNetrunnerNews() + "</h2></p><ul>";
   }
+  else if (distro == ectn_PARABOLA)
+  {
+    html = "<p align=\"center\"><h2>" + StrConstants::getParabolaNews() + "</h2></p><ul>";
+  }
 
   QString rssPath = QDir::homePath() + QDir::separator() + ".config/octopi/distro_rss.xml";
   QDomDocument doc("rss");