summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oglobal.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/oglobal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oglobal.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp
index 1aa206e..ea02058 100644
--- a/libopie2/opiecore/oglobal.cpp
+++ b/libopie2/opiecore/oglobal.cpp
@@ -17,48 +17,50 @@
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/oglobal.h>
#include <qtextstream.h>
#include <qdir.h>
#include <qpe/mimetype.h>
#include <qpe/qpeapplication.h>
#include <qpe/storage.h>
#include <unistd.h>
#include <sys/types.h>
+using namespace Opie::Core;
+
static const char Base64EncMap[64] =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
};
static char Base64DecMap[128] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3F,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
0x3C, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
@@ -291,60 +293,60 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) {
{
out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
out[didx+1] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
out[didx+2] = (((out[sidx+2] << 6) & 255) | (out[sidx+3] & 077));
sidx += 4;
didx += 3;
}
}
if (didx < len)
out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
if (++didx < len )
out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
// Resize the output buffer
if ( len == 0 || len < out.size() )
out.resize(len);
return out;
}
bool OGlobal::isAppLnkFileName( const QString& str )
{
- if (str.length()==0||str.at(str.length()-1)==QDir::separator()) return false;
+ if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false;
return str.startsWith(MimeType::appsFolderName()+QDir::separator());
}
/* ToDo:
* This fun should check the document-path value for the mounted media
* which has to be implemented later. this moment we just check for a
* mounted media name.
*/
bool OGlobal::isDocumentFileName( const QString& file )
{
- if (file.length()==0||file.at(file.length()-1)==QDir::separator()) return false;
+ if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false;
if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true;
StorageInfo si;
QList< FileSystem > fl = si.fileSystems();
FileSystem*fs;
for (fs = fl.first();fs!=0;fs=fl.next()) {
if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator()))
return true;
}
if (file.startsWith(homeDirPath())+"/Documents/") return true;
return false;
}
QString OGlobal::tempDirPath()
{
static QString defstring="/tmp";
char * tmpp = 0;
if ( (tmpp=getenv("TEMP"))) {
return tmpp;
}
return defstring;
}
QString OGlobal::homeDirPath()
{