File indexing completed on 2024-11-24 04:59:24
0001 // because we put the following line in the metadata.desktop file, we have access 0002 // to the HTTP extension in this Plasmoid. 0003 // 0004 // X-Plasma-RequiredExtensions=http 0005 // 0006 // More documentation can be found here: 0007 // 0008 // https://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/API#Extensions 0009 0010 output = new TextEdit 0011 output.readOnly = true 0012 0013 layout = new LinearLayout 0014 layout.orientation = QtVertical 0015 layout.addItem(output) 0016 0017 // in case our request for HTTP urls in the metadata.desktop was rejected (e.g. due 0018 // to security restrictions) we won't have a plasmoid.get, so let's check for it 0019 // before using it! 0020 if (plasmoid.getUrl) { 0021 var getJob = plasmoid.getUrl("https://dot.kde.org/rss.xml"); 0022 function recv(job, data) 0023 { 0024 if (job == getJob) { 0025 print("we have our job") 0026 if (data.length) { 0027 output.append(data.toUtf8()) 0028 } 0029 } 0030 } 0031 0032 function fini(job) 0033 { 0034 if (job == getJob) { 0035 print("our job is finished") 0036 } else { 0037 print("some other job is finished?") 0038 } 0039 } 0040 0041 getJob.data.connect(recv) 0042 getJob.finished.connect(fini) 0043 } else { 0044 output.text = i18n("HTTP access denied!") 0045 }