• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

ark

  • sources
  • kde-4.14
  • kdeutils
  • ark
  • kerfuffle
archiveinterface.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
3  * Copyright (c) 2008-2009 Harald Hvaal <haraldhv@stud.ntnu.no>
4  * Copyright (c) 2009-2012 Raphael Kubo da Costa <rakuco@FreeBSD.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "archiveinterface.h"
29 #include <kdebug.h>
30 #include <kfileitem.h>
31 
32 #include <QFileInfo>
33 #include <QDir>
34 
35 namespace Kerfuffle
36 {
37 ReadOnlyArchiveInterface::ReadOnlyArchiveInterface(QObject *parent, const QVariantList & args)
38  : QObject(parent), m_waitForFinishedSignal(false)
39 {
40  kDebug();
41  m_filename = args.first().toString();
42 }
43 
44 ReadOnlyArchiveInterface::~ReadOnlyArchiveInterface()
45 {
46 }
47 
48 QString ReadOnlyArchiveInterface::filename() const
49 {
50  return m_filename;
51 }
52 
53 bool ReadOnlyArchiveInterface::isReadOnly() const
54 {
55  return true;
56 }
57 
58 bool ReadOnlyArchiveInterface::open()
59 {
60  return true;
61 }
62 
63 void ReadOnlyArchiveInterface::setPassword(const QString &password)
64 {
65  m_password = password;
66 }
67 
68 QString ReadOnlyArchiveInterface::password() const
69 {
70  return m_password;
71 }
72 
73 bool ReadOnlyArchiveInterface::doKill()
74 {
75  //default implementation
76  return false;
77 }
78 
79 bool ReadOnlyArchiveInterface::doSuspend()
80 {
81  //default implementation
82  return false;
83 }
84 
85 bool ReadOnlyArchiveInterface::doResume()
86 {
87  //default implementation
88  return false;
89 }
90 
91 ReadWriteArchiveInterface::ReadWriteArchiveInterface(QObject *parent, const QVariantList & args)
92  : ReadOnlyArchiveInterface(parent, args)
93 {
94 }
95 
96 ReadWriteArchiveInterface::~ReadWriteArchiveInterface()
97 {
98 }
99 
100 bool ReadOnlyArchiveInterface::waitForFinishedSignal()
101 {
102  return m_waitForFinishedSignal;
103 }
104 
105 void ReadOnlyArchiveInterface::setWaitForFinishedSignal(bool value)
106 {
107  m_waitForFinishedSignal = value;
108 }
109 
110 bool ReadWriteArchiveInterface::isReadOnly() const
111 {
112  QFileInfo fileInfo(filename());
113  if (fileInfo.exists()) {
114  return ! fileInfo.isWritable();
115  } else {
116  return !fileInfo.dir().exists(); // TODO: Should also check if we can create a file in that directory
117  }
118 }
119 
120 } // namespace Kerfuffle
121 
122 #include "archiveinterface.moc"
Kerfuffle::ReadOnlyArchiveInterface::setWaitForFinishedSignal
void setWaitForFinishedSignal(bool value)
Setting this option to true will not exit the thread with the exit of the various functions...
Definition: archiveinterface.cpp:105
Kerfuffle::ReadOnlyArchiveInterface::doSuspend
virtual bool doSuspend()
Definition: archiveinterface.cpp:79
Kerfuffle::ReadOnlyArchiveInterface::filename
QString filename() const
Returns the filename of the archive currently being handled.
Definition: archiveinterface.cpp:48
Kerfuffle::ReadWriteArchiveInterface::ReadWriteArchiveInterface
ReadWriteArchiveInterface(QObject *parent, const QVariantList &args)
Definition: archiveinterface.cpp:91
Kerfuffle::ReadOnlyArchiveInterface
Definition: archiveinterface.h:43
Kerfuffle::ReadOnlyArchiveInterface::password
QString password() const
Definition: archiveinterface.cpp:68
QDir::exists
bool exists() const
archiveinterface.h
Kerfuffle::ReadOnlyArchiveInterface::setPassword
void setPassword(const QString &password)
Definition: archiveinterface.cpp:63
QObject
Kerfuffle::ReadOnlyArchiveInterface::doResume
virtual bool doResume()
Definition: archiveinterface.cpp:85
Kerfuffle::ReadOnlyArchiveInterface::ReadOnlyArchiveInterface
ReadOnlyArchiveInterface(QObject *parent, const QVariantList &args)
Definition: archiveinterface.cpp:37
QFileInfo::dir
QDir dir() const
QString
Kerfuffle::ReadOnlyArchiveInterface::~ReadOnlyArchiveInterface
virtual ~ReadOnlyArchiveInterface()
Definition: archiveinterface.cpp:44
Kerfuffle::ReadWriteArchiveInterface::~ReadWriteArchiveInterface
virtual ~ReadWriteArchiveInterface()
Definition: archiveinterface.cpp:96
Kerfuffle::ReadOnlyArchiveInterface::open
virtual bool open()
Definition: archiveinterface.cpp:58
QFileInfo
QFileInfo::exists
bool exists() const
Kerfuffle::ReadWriteArchiveInterface::isReadOnly
virtual bool isReadOnly() const
Returns whether the file can only be read.
Definition: archiveinterface.cpp:110
Kerfuffle::ReadOnlyArchiveInterface::isReadOnly
virtual bool isReadOnly() const
Returns whether the file can only be read.
Definition: archiveinterface.cpp:53
Kerfuffle::ReadOnlyArchiveInterface::waitForFinishedSignal
bool waitForFinishedSignal()
Definition: archiveinterface.cpp:100
QFileInfo::isWritable
bool isWritable() const
Kerfuffle::ReadOnlyArchiveInterface::doKill
virtual bool doKill()
Definition: archiveinterface.cpp:73
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ark

Skip menu "ark"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal