kioslaves

readmbox.h

Go to the documentation of this file.
00001 /*
00002  * This is a simple kioslave to handle mbox-files.
00003  * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl)
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 #ifndef READMBOX_H
00020 #define READMBOX_H
00021 
00022 #include "mboxfile.h"
00023 
00024 class UrlInfo;
00025 class MBox;
00026 
00027 class QFile;
00028 class QString;
00029 class QTextStream;
00030 
00031 struct utimbuf;
00032 
00036 class ReadMBox : public MBoxFile
00037 {
00038 public:
00047     ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew = false, bool savetime = false );
00048 
00052     ~ReadMBox();
00053 
00058     QString currentLine() const;
00059 
00065     QString currentID() const;
00066 
00073     bool nextLine();
00074 
00081     bool searchMessage( const QString& id );
00082 
00089     unsigned int skipMessage();
00090 
00094     void rewind();
00095 
00100     bool atEnd() const;
00101 
00106     bool inListing() const;
00107 private:
00112     bool open( bool savetime );
00113 
00117     void close();
00118 
00119 private:
00120     QFile* m_file;
00121     QTextStream* m_stream;
00122     QString* m_current_line;
00123     QString* m_current_id;
00124     bool m_atend;
00125 
00126     struct utimbuf* m_prev_time;
00127 
00128     bool m_only_new, m_savetime;
00129 
00130     bool m_status, m_prev_status, m_header;
00131 };
00132 #endif