~ubuntu-branches/ubuntu/vivid/smb4k/vivid

« back to all changes in this revision

Viewing changes to core/smb4kpreviewitem.cpp

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20120519185434-duffny2n87214n1n
Tags: 1.0.1-1
* New upstream release.
* Update debian/compat: bump to 9.
* Update debian/control:
  - bump debhelper to 9.
  - bump kdelibs5-dev build dependency to 4:4.4.0.
  - bump Standards-Version to 3.9.3 (no changes needed).
  - Replace smbfs dependency by cifs-utils. (Closes: #638162)
* Update debian/copyright:
  - update upstream URL.
  - update upstream e-mail.
* Update debian/smb4k.lintian-overrides file.
* Update debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
    smb4kpreviewitem  -   A container for previews of a remote share
3
 
                             -------------------
4
 
    begin                : Mo Mai 28 2007
5
 
    copyright            : (C) 2007 by Alexander Reinholdt
6
 
    email                : dustpuppy@users.berlios.de
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *   This program is free software; you can redistribute it and/or modify  *
11
 
 *   it under the terms of the GNU General Public License as published by  *
12
 
 *   the Free Software Foundation; either version 2 of the License, or     *
13
 
 *   (at your option) any later version.                                   *
14
 
 *                                                                         *
15
 
 *   This program is distributed in the hope that it will be useful, but   *
16
 
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
17
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
18
 
 *   General Public License for more details.                              *
19
 
 *                                                                         *
20
 
 *   You should have received a copy of the GNU General Public License     *
21
 
 *   along with this program; if not, write to the                         *
22
 
 *   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,   *
23
 
 *   MA  02111-1307 USA                                                    *
24
 
 ***************************************************************************/
25
 
 
26
 
// KDE includes
27
 
#include <QHostAddress>
28
 
 
29
 
// application specific includes
30
 
#include <smb4kpreviewitem.h>
31
 
 
32
 
Smb4KPreviewItem::Smb4KPreviewItem( Smb4KShare *share, const QString &path )
33
 
: m_share( *share )
34
 
{
35
 
  setPath( path );
36
 
}
37
 
 
38
 
 
39
 
Smb4KPreviewItem::~Smb4KPreviewItem()
40
 
{
41
 
}
42
 
 
43
 
 
44
 
void Smb4KPreviewItem::setPath( const QString &path )
45
 
{
46
 
  if ( path.trimmed().isEmpty() )
47
 
  {
48
 
    m_path = "/";
49
 
  }
50
 
  else
51
 
  {
52
 
    m_path = path+(!path.endsWith( "/" ) ? "/" : QString());
53
 
  }
54
 
 
55
 
  m_location = m_share.unc()+m_path;
56
 
 
57
 
  clearContents();
58
 
}
59
 
 
60
 
 
61
 
void Smb4KPreviewItem::addContents( const ContentsItem &item )
62
 
{
63
 
  m_contents.append( item );
64
 
}
65
 
 
66
 
 
67
 
void Smb4KPreviewItem::clearContents()
68
 
{
69
 
  m_contents.clear();
70
 
}
71
 
 
72
 
 
73
 
bool Smb4KPreviewItem::isRootDirectory()
74
 
{
75
 
  if ( QString::compare( m_path.trimmed(), "/" ) == 0 )
76
 
  {
77
 
    return true;
78
 
  }
79
 
  else
80
 
  {
81
 
    // Do nothing
82
 
  }
83
 
 
84
 
  return false;
85
 
}
86
 
 
87