summaryrefslogtreecommitdiffstats
path: root/quanta/treeviews/uploadtreefile.cpp
blob: b4ad68458089f4f6ffc47e50416e30b8c4253459 (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
/***************************************************************************
                          uploadtreefile.cpp  -  description
                             -------------------
    begin                : Sun Aug 25 2002
    copyright            : (C) 2002, 2003 by Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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; version 2 of the License.               *
 *                                                                         *
 ***************************************************************************/

// QT includes
#include <tqdir.h>
#include <tqpixmap.h>
#include <tqfileinfo.h>

// KDE includes
#include <kfileitem.h>
#include <kiconloader.h>
#include <kurl.h>

// app includes
#include "uploadtreefile.h"
#include "resource.h"

UploadTreeFile::UploadTreeFile( UploadTreeFolder *tqparent, const KURL &a_url, const KFileItem &a_fileItem)
    : KListViewItem( tqparent, a_url.fileName(), "", TQString("%1").tqarg( (long int)a_fileItem.size() ), a_fileItem.timeString())
{
  m_url = a_url;
  isDir = false;
  parentFolder = tqparent;
  m_fileItem = new KFileItem(a_fileItem);
  m_confirm = false;

  setWhichPixmap("check_clear");
  setText(0, m_url.fileName());
}

UploadTreeFile::UploadTreeFile( TQListView *tqparent, const KURL &a_url, const KFileItem &a_fileItem)
    : KListViewItem( tqparent, a_url.fileName(), "", TQString("%1").tqarg( (long int)a_fileItem.size() ), a_fileItem.timeString())
{
  m_url = a_url;
  isDir = false;
  parentFolder = 0L;
  m_fileItem = new KFileItem(a_fileItem);
  m_confirm = false;

  //setPixmap( 1, SmallIcon("check") );
  setWhichPixmap("check_clear");
  setText(0, m_url.fileName());
}


UploadTreeFile::~UploadTreeFile()
{
  delete m_fileItem;
}

int UploadTreeFile::permissions()
{
  if (m_fileItem)
      return m_fileItem->permissions();
  else
      return -1;
}

/** used for sorting */
TQString UploadTreeFile::key ( int, bool ) const
{
  static TQString key;
  key  = TQString( "1" + text(0) );
  return key;
//  return TQFileInfo(key).extension()+key;
}

void UploadTreeFile::setWhichPixmap(const TQString& pixmap )
{
  setPixmap( 1, SmallIcon(pixmap) );
}

/** No descriptions */
KURL UploadTreeFile::url()
{
  return m_url;
}