summaryrefslogtreecommitdiffstats
path: root/knode/knconvert.h
blob: e81e048a577cd79918c4d107fc65bea8f940fabb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
    KNode, the KDE newsreader
    Copyright (c) 1999-2005 the KNode authors.
    See file AUTHORS for details

    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.
    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, US
*/

#ifndef KNCONVERT_H
#define KNCONVERT_H

#include <time.h>

#include <tqdialog.h>

#include <tqglobal.h>
#include <tqvaluelist.h>
#include <kdepimmacros.h>

class QListBox;
class QLabel;
class QWidgetStack;
class QCheckBox;

class KLineEdit;
class KProcess;


class KDE_EXPORT KNConvert : public TQDialog {

  Q_OBJECT

  public:
    static bool needToConvert(const TQString &oldVersion);

    KNConvert(const TQString &version);
    ~KNConvert();
    bool conversionDone()const { return c_onversionDone; }


  protected:

    //------------ <Converter-classes> ---------------

    //Base class for all converters
    class Converter {

      public:
        Converter(TQStringList *log) { l_og=log; }
        virtual ~Converter() {}
        virtual bool doConvert()=0;

      protected:
        TQStringList *l_og;
    };


    //Converter for version 0.4
    class Converter04 : public Converter {

      public:
        Converter04(TQStringList *log) : Converter(log) {}
        ~Converter04() {}
        bool doConvert();

      protected:
        int convertFolder(TQString srcPrefix, TQString dstPrefix);

        struct OldFolderIndex {
          int id,
              status,
              so,
              eo,
              sId;
          time_t ti;
        };

        struct NewFolderIndex {
          int id,
              so,
              eo,
              sId;
          time_t ti;
          bool flags[6];
        };
    };

    //------------ </Converter-classes> --------------

    TQWidgetStack  *s_tack;
    TQWidget       *w_1,
                  *w_3;
    TQCheckBox     *c_reateBkup;
    TQLabel        *b_ackupPathLabel,
                  *w_2,
                  *r_esultLabel;
    KLineEdit     *b_ackupPath;
    TQPushButton   *b_rowseBtn,
                  *s_tartBtn,
                  *c_ancelBtn;
    TQListBox      *l_ogList;

    TQValueList<Converter*> mConverters;
    TQStringList l_og;
    bool c_onversionDone;
    TQString v_ersion;
    KProcess     *t_ar;

    void convert();

  protected slots:
    void slotStart();
    void slotCreateBkupToggled(bool b);
    void slotBrowse();
    void slotTarExited(KProcess *proc);

};


#endif // KNCONVERT_H