KMBox Library
mbox_p.h
00001 /* 00002 Copyright (c) 2009 Bertjan Broeksema <broeksema@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KMBOX_MBOX_P_H 00021 #define KMBOX_MBOX_P_H 00022 00023 #include "mbox.h" 00024 00025 #include <QtCore/QFile> 00026 #include <QtCore/QObject> 00027 #include <QtCore/QTimer> 00028 00029 namespace KMBox { 00030 00031 class MBoxPrivate : public QObject 00032 { 00033 Q_OBJECT 00034 00035 public: 00036 MBoxPrivate( MBox *mbox ); 00037 00038 virtual ~MBoxPrivate(); 00039 00040 void close(); 00041 00042 void initLoad( const QString &fileName ); 00043 00044 bool open(); 00045 00046 bool startTimerIfNeeded(); 00047 00048 bool isMBoxSeparator( const QByteArray &line ) const; 00049 00050 public Q_SLOTS: 00051 void unlockMBox(); 00052 00053 public: 00054 QByteArray mAppendedEntries; 00055 MBoxEntry::List mEntries; 00056 bool mFileLocked; 00057 quint64 mInitialMboxFileSize; 00058 QString mLockFileName; 00059 MBox::LockType mLockType; 00060 MBox *mMBox; 00061 QFile mMboxFile; 00062 bool mReadOnly; 00063 QTimer mUnlockTimer; 00064 QRegExp mSeparatorMatcher; 00065 00066 public: 00067 static QByteArray escapeFrom( const QByteArray &msg ); 00068 00072 static QByteArray mboxMessageSeparator( const QByteArray &msg ); 00073 00077 static void unescapeFrom( char *msg, size_t size ); 00078 }; 00079 00080 } 00081 00082 #endif // KMBOX_MBOX_P_H