summaryrefslogtreecommitdiffstats
path: root/file-integration
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-10 00:18:25 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-10 00:18:25 +0000
commitf21e5792b5084f5d008bf46f6316030c6dfb31e5 (patch)
treed51583b36aa1672bac78d98a682cdc330df27e4d /file-integration
downloadbasket-f21e5792b5084f5d008bf46f6316030c6dfb31e5.tar.gz
basket-f21e5792b5084f5d008bf46f6316030c6dfb31e5.zip
Add author-abandoned basket application
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1072339 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'file-integration')
-rw-r--r--file-integration/Makefile.am23
-rw-r--r--file-integration/basket.magic2
-rw-r--r--file-integration/basketthumbcreator.cpp117
-rw-r--r--file-integration/basketthumbcreator.desktop18
-rw-r--r--file-integration/basketthumbcreator.h29
-rw-r--r--file-integration/cr128-mime-baskets.pngbin0 -> 12586 bytes
-rw-r--r--file-integration/cr128-mime-baskett.pngbin0 -> 15162 bytes
-rw-r--r--file-integration/cr16-mime-baskets.pngbin0 -> 672 bytes
-rw-r--r--file-integration/cr16-mime-baskett.pngbin0 -> 766 bytes
-rw-r--r--file-integration/cr22-mime-baskets.pngbin0 -> 1031 bytes
-rw-r--r--file-integration/cr22-mime-baskett.pngbin0 -> 1219 bytes
-rw-r--r--file-integration/cr32-mime-baskets.pngbin0 -> 1766 bytes
-rw-r--r--file-integration/cr32-mime-baskett.pngbin0 -> 2088 bytes
-rw-r--r--file-integration/cr48-mime-baskets.pngbin0 -> 3290 bytes
-rw-r--r--file-integration/cr48-mime-baskett.pngbin0 -> 3858 bytes
-rw-r--r--file-integration/cr64-mime-baskets.pngbin0 -> 4925 bytes
-rw-r--r--file-integration/cr64-mime-baskett.pngbin0 -> 5915 bytes
-rw-r--r--file-integration/x-basket-archive.desktop17
-rw-r--r--file-integration/x-basket-template.desktop17
19 files changed, 223 insertions, 0 deletions
diff --git a/file-integration/Makefile.am b/file-integration/Makefile.am
new file mode 100644
index 0000000..f525b54
--- /dev/null
+++ b/file-integration/Makefile.am
@@ -0,0 +1,23 @@
+# MIME Types Information:
+applicationmimedir = $(kde_mimedir)/application
+applicationmime_DATA = x-basket-archive.desktop x-basket-template.desktop
+
+# Magic MIME Types Discovery:
+magicdir = $(kde_confdir)/magic
+magic_DATA = basket.magic
+
+# Thumbnail Creator:
+INCLUDES = $(all_includes)
+kde_module_LTLIBRARIES = basketthumbcreator.la
+basketthumbcreator_la_SOURCES = basketthumbcreator.cpp
+basketthumbcreator_la_LIBADD = $(LIB_KIO)
+basketthumbcreator_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kde_services_DATA = basketthumbcreator.desktop
+
+# Icons:
+KDE_ICON = AUTO
+#kde_icon_KDEICON = \
+# cr128-mimetype-baskets.png cr16-mimetype-baskets.png cr22-mimetype-baskets.png \
+# cr32-mimetype-baskets.png cr48-mimetype-baskets.png cr64-mimetype-baskets.png \
+# cr128-mimetype-baskett.png cr16-mimetype-baskett.png cr22-mimetype-baskett.png \
+# cr32-mimetype-baskett.png cr48-mimetype-baskett.png cr64-mimetype-baskett.png
diff --git a/file-integration/basket.magic b/file-integration/basket.magic
new file mode 100644
index 0000000..bad0e39
--- /dev/null
+++ b/file-integration/basket.magic
@@ -0,0 +1,2 @@
+0 string BasKetNP:archive\n application/x-basket-archive
+0 string BasKetNP:template\n application/x-basket-template
diff --git a/file-integration/basketthumbcreator.cpp b/file-integration/basketthumbcreator.cpp
new file mode 100644
index 0000000..afad656
--- /dev/null
+++ b/file-integration/basketthumbcreator.cpp
@@ -0,0 +1,117 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Sébastien Laoût *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include <qstringlist.h>
+#include <qdir.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qtextstream.h>
+#include <ktempdir.h>
+
+#include "basketthumbcreator.h"
+
+bool BasketThumbCreator::create(const QString &path, int /*width*/, int /*height*/, QImage &image)
+{
+ // Create the temporar folder:
+ KTempDir tempDir;
+ tempDir.setAutoDelete(true);
+ QString tempFolder = tempDir.name();
+ QDir dir;
+ dir.mkdir(tempFolder);
+ const Q_ULONG BUFFER_SIZE = 1024;
+
+ QFile file(path);
+ if (file.open(IO_ReadOnly)) {
+ QTextStream stream(&file);
+ stream.setEncoding(QTextStream::Latin1);
+ QString line = stream.readLine();
+ if (line != "BasKetNP:archive" && line != "BasKetNP:template") {
+ file.close();
+ return false;
+ }
+ while (!stream.atEnd()) {
+ // Get Key/Value Pair From the Line to Read:
+ line = stream.readLine();
+ int index = line.find(':');
+ QString key;
+ QString value;
+ if (index >= 0) {
+ key = line.left(index);
+ value = line.right(line.length() - index - 1);
+ } else {
+ key = line;
+ value = "";
+ }
+ if (key == "preview*") {
+ bool ok;
+ ulong size = value.toULong(&ok);
+ if (!ok) {
+ file.close();
+ return false;
+ }
+ // Get the preview file:
+ QFile previewFile(tempFolder + "preview.png");
+ if (previewFile.open(IO_WriteOnly)) {
+ char *buffer = new char[BUFFER_SIZE];
+ Q_LONG sizeRead;
+ while ((sizeRead = file.readBlock(buffer, QMIN(BUFFER_SIZE, size))) > 0) {
+ previewFile.writeBlock(buffer, sizeRead);
+ size -= sizeRead;
+ }
+ previewFile.close();
+ delete buffer;
+ image = QImage(tempFolder + "preview.png");
+ file.close();
+ return true;
+ }
+ } else if (key.endsWith("*")) {
+ // We do not know what it is, but we should read the embedded-file in order to discard it:
+ bool ok;
+ ulong size = value.toULong(&ok);
+ if (!ok) {
+ file.close();
+ return false;
+ }
+ // Get the archive file:
+ char *buffer = new char[BUFFER_SIZE];
+ Q_LONG sizeRead;
+ while ((sizeRead = file.readBlock(buffer, QMIN(BUFFER_SIZE, size))) > 0) {
+ size -= sizeRead;
+ }
+ delete buffer;
+ }
+ }
+ file.close();
+ }
+ return false;
+}
+
+ThumbCreator::Flags BasketThumbCreator::flags() const
+{
+ return (Flags) (DrawFrame | BlendIcon);
+}
+
+extern "C"
+{
+ ThumbCreator *new_creator()
+ {
+ return new BasketThumbCreator();
+ }
+};
diff --git a/file-integration/basketthumbcreator.desktop b/file-integration/basketthumbcreator.desktop
new file mode 100644
index 0000000..612e6cb
--- /dev/null
+++ b/file-integration/basketthumbcreator.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Name=Basket Archives & Templates
+Name[de]=Korbarchiv und Korbvorlagen
+Name[es]=Archivo de cestas y plantillas
+Name[fr]=Archive de paniers et modèles
+Name[it]=Archivi e modelli di canestri
+Name[ja]=バスケットアーカイブとテンプレート
+Name[nb]=Kurvarkiv og kurvmaler
+Name[nn]=Korgarkiv og korgmalar
+Name[pt]=Arquivos e modelos de cestos
+Name[ru]=Шаблоны и контейнеры Basket
+Name[tr]=Basket Arşivleri & Şablonları
+ServiceTypes=ThumbCreator
+MimeTypes=application/x-basket-archive,application/x-basket-template
+CacheThumbnail=true
+X-KDE-Library=basketthumbcreator
diff --git a/file-integration/basketthumbcreator.h b/file-integration/basketthumbcreator.h
new file mode 100644
index 0000000..8a10cab
--- /dev/null
+++ b/file-integration/basketthumbcreator.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Sébastien Laoût *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include <qstring.h>
+#include <qimage.h>
+#include <kio/thumbcreator.h>
+
+class BasketThumbCreator : public ThumbCreator
+{
+ bool create(const QString &path, int width, int height, QImage &image);
+ Flags flags() const;
+};
diff --git a/file-integration/cr128-mime-baskets.png b/file-integration/cr128-mime-baskets.png
new file mode 100644
index 0000000..39df80a
--- /dev/null
+++ b/file-integration/cr128-mime-baskets.png
Binary files differ
diff --git a/file-integration/cr128-mime-baskett.png b/file-integration/cr128-mime-baskett.png
new file mode 100644
index 0000000..80e6143
--- /dev/null
+++ b/file-integration/cr128-mime-baskett.png
Binary files differ
diff --git a/file-integration/cr16-mime-baskets.png b/file-integration/cr16-mime-baskets.png
new file mode 100644
index 0000000..222e4dc
--- /dev/null
+++ b/file-integration/cr16-mime-baskets.png
Binary files differ
diff --git a/file-integration/cr16-mime-baskett.png b/file-integration/cr16-mime-baskett.png
new file mode 100644
index 0000000..053f39a
--- /dev/null
+++ b/file-integration/cr16-mime-baskett.png
Binary files differ
diff --git a/file-integration/cr22-mime-baskets.png b/file-integration/cr22-mime-baskets.png
new file mode 100644
index 0000000..2f82d4e
--- /dev/null
+++ b/file-integration/cr22-mime-baskets.png
Binary files differ
diff --git a/file-integration/cr22-mime-baskett.png b/file-integration/cr22-mime-baskett.png
new file mode 100644
index 0000000..50502c4
--- /dev/null
+++ b/file-integration/cr22-mime-baskett.png
Binary files differ
diff --git a/file-integration/cr32-mime-baskets.png b/file-integration/cr32-mime-baskets.png
new file mode 100644
index 0000000..06baf90
--- /dev/null
+++ b/file-integration/cr32-mime-baskets.png
Binary files differ
diff --git a/file-integration/cr32-mime-baskett.png b/file-integration/cr32-mime-baskett.png
new file mode 100644
index 0000000..ff1d499
--- /dev/null
+++ b/file-integration/cr32-mime-baskett.png
Binary files differ
diff --git a/file-integration/cr48-mime-baskets.png b/file-integration/cr48-mime-baskets.png
new file mode 100644
index 0000000..44bcac5
--- /dev/null
+++ b/file-integration/cr48-mime-baskets.png
Binary files differ
diff --git a/file-integration/cr48-mime-baskett.png b/file-integration/cr48-mime-baskett.png
new file mode 100644
index 0000000..bec312b
--- /dev/null
+++ b/file-integration/cr48-mime-baskett.png
Binary files differ
diff --git a/file-integration/cr64-mime-baskets.png b/file-integration/cr64-mime-baskets.png
new file mode 100644
index 0000000..7110777
--- /dev/null
+++ b/file-integration/cr64-mime-baskets.png
Binary files differ
diff --git a/file-integration/cr64-mime-baskett.png b/file-integration/cr64-mime-baskett.png
new file mode 100644
index 0000000..7ec455b
--- /dev/null
+++ b/file-integration/cr64-mime-baskett.png
Binary files differ
diff --git a/file-integration/x-basket-archive.desktop b/file-integration/x-basket-archive.desktop
new file mode 100644
index 0000000..7c2992d
--- /dev/null
+++ b/file-integration/x-basket-archive.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Encoding=UTF-8
+MimeType=application/x-basket-archive
+Type=MimeType
+Comment=Basket Archive
+Comment[de]=Korbarchiv
+Comment[es]=Archivo de cestas
+Comment[fr]=Archive de paniers
+Comment[it]=Archivio di canestri
+Comment[ja]=バスケットアーカイブ
+Comment[nb]=Kurvarkiv
+Comment[nn]=Korgarkiv
+Comment[pt]=Ficheiro de cestos
+Comment[ru]=Контейнер Basket
+Comment[tr]=Basket Arşivi
+Icon=baskets
+Patterns=*.baskets
diff --git a/file-integration/x-basket-template.desktop b/file-integration/x-basket-template.desktop
new file mode 100644
index 0000000..413d231
--- /dev/null
+++ b/file-integration/x-basket-template.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Encoding=UTF-8
+MimeType=application/x-basket-template
+Type=MimeType
+Comment=Basket Template
+Comment[de]=Korbvorlage
+Comment[es]=Plantilla de cesta
+Comment[fr]=Modèle de panier
+Comment[it]=Modello di canestri
+Comment[ja]=バスケットテンプレート
+Comment[nb]=Kurvmal
+Comment[nn]=Korgmal
+Comment[pt]=Modelo de cesto
+Comment[ru]=Шаблон корзины
+Comment[tr]=Basket Şabolonu
+Icon=baskett
+Patterns=*.baskett