You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1394 lines
57 KiB
1394 lines
57 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>Simple Filemanager</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Simple Filemanager</h1>
|
|
|
|
|
|
<p>
|
|
This example implements a simple and not fully functional file manager using
|
|
a widget derived from <a href="tqiconview.html">TQIconView</a> to display the current directory.
|
|
To display the directory tree the
|
|
widget written in the <a href="dirview-example.html">dirview</a> example is
|
|
used.
|
|
<p> <hr>
|
|
<p> Header file of the file icon view:
|
|
<p> <pre>/****************************************************************************
|
|
** $Id: qt/tqfileiconview.h 3.3.8 edited Jan 11 14:37 $
|
|
**
|
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|
**
|
|
** This file is part of an example program for TQt. This example
|
|
** program may be used, distributed and modified without limitation.
|
|
**
|
|
*****************************************************************************/
|
|
|
|
#ifndef TQTFILEICONVIEW_H
|
|
#define TQTFILEICONVIEW_H
|
|
|
|
|
|
#include <<a href="tqiconset-h.html">tqiconset.h</a>>
|
|
#include <<a href="tqstring-h.html">tqstring.h</a>>
|
|
#include <<a href="tqfileinfo-h.html">tqfileinfo.h</a>>
|
|
#include <<a href="tqdir-h.html">tqdir.h</a>>
|
|
#include <<a href="tqtimer-h.html">tqtimer.h</a>>
|
|
#include <<a href="tqiconview-h.html">tqiconview.h</a>>
|
|
|
|
class TQtFileIconView;
|
|
class TQDragObject;
|
|
class TQResizeEvent;
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Class TQtFileIconDrag
|
|
*
|
|
*****************************************************************************/
|
|
|
|
class TQtFileIconDrag : public <a href="tqicondrag.html">TQIconDrag</a>
|
|
{
|
|
<a href="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a>
|
|
|
|
public:
|
|
TQtFileIconDrag( <a href="tqwidget.html">TQWidget</a> * dragSource, const char* name = 0 );
|
|
|
|
const char* format( int i ) const;
|
|
<a href="tqbytearray.html">TQByteArray</a> encodedData( const char* mime ) const;
|
|
static bool canDecode( <a href="tqmimesource.html">TQMimeSource</a>* e );
|
|
void append( const <a href="tqicondragitem.html">TQIconDragItem</a> &item, const <a href="tqrect.html">TQRect</a> &pr, const <a href="tqrect.html">TQRect</a> &tr, const <a href="tqstring.html">TQString</a> &url );
|
|
|
|
private:
|
|
<a href="tqstringlist.html">TQStringList</a> urls;
|
|
|
|
};
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Class TQtFileIconView
|
|
*
|
|
*****************************************************************************/
|
|
class TQtFileIconViewItem;
|
|
class TQtFileIconView : public <a href="tqiconview.html">TQIconView</a>
|
|
{
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
TQtFileIconView( const <a href="tqstring.html">TQString</a> &dir, TQWidget *parent = 0, const char *name = 0 );
|
|
|
|
enum ViewMode { Large, Small };
|
|
|
|
void setViewMode( ViewMode m );
|
|
ViewMode viewMode() const { return vm; }
|
|
void setOpenItem( TQtFileIconViewItem *i ) {
|
|
openItem = i;
|
|
}
|
|
|
|
public slots:
|
|
void setDirectory( const <a href="tqstring.html">TQString</a> &dir );
|
|
void setDirectory( const <a href="tqdir.html">TQDir</a> &dir );
|
|
void newDirectory();
|
|
<a href="tqdir.html">TQDir</a> currentDir();
|
|
|
|
signals:
|
|
void directoryChanged( const <a href="tqstring.html">TQString</a> & );
|
|
void startReadDir( int dirs );
|
|
void readNextDir();
|
|
void readDirDone();
|
|
void enableUp();
|
|
void disableUp();
|
|
void enableMkdir();
|
|
void disableMkdir();
|
|
|
|
protected slots:
|
|
void itemDoubleClicked( <a href="tqiconviewitem.html">TQIconViewItem</a> *i );
|
|
void slotDropped( <a href="tqdropevent.html">TQDropEvent</a> *e, const <a href="tqvaluelist.html">TQValueList</a><TQIconDragItem> & );
|
|
|
|
void viewLarge();
|
|
void viewSmall();
|
|
void viewBottom();
|
|
void viewRight();
|
|
void flowEast();
|
|
void flowSouth();
|
|
void itemTextTruncate();
|
|
void itemTextWordWrap();
|
|
void sortAscending();
|
|
void sortDescending();
|
|
void arrangeItemsInGrid() {
|
|
<a name="x807"></a> TQIconView::<a href="tqiconview.html#arrangeItemsInGrid">arrangeItemsInGrid</a>( TRUE );
|
|
}
|
|
|
|
void slotRightPressed( <a href="tqiconviewitem.html">TQIconViewItem</a> *item );
|
|
void openFolder();
|
|
|
|
protected:
|
|
void readDir( const <a href="tqdir.html">TQDir</a> &dir );
|
|
virtual TQDragObject *dragObject();
|
|
|
|
virtual void keyPressEvent( <a href="tqkeyevent.html">TQKeyEvent</a> *e );
|
|
|
|
<a href="tqdir.html">TQDir</a> viewDir;
|
|
int newFolderNum;
|
|
<a href="tqsize.html">TQSize</a> sz;
|
|
<a href="tqpixmap.html">TQPixmap</a> pix;
|
|
ViewMode vm;
|
|
TQtFileIconViewItem *openItem;
|
|
|
|
};
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Class TQtFileIconViewItem
|
|
*
|
|
*****************************************************************************/
|
|
|
|
class TQtFileIconViewItem : public <a href="tqiconviewitem.html">TQIconViewItem</a>
|
|
{
|
|
friend class TQtFileIconView;
|
|
|
|
public:
|
|
enum ItemType {
|
|
File = 0,
|
|
Dir,
|
|
Link
|
|
};
|
|
|
|
TQtFileIconViewItem( TQtFileIconView *parent, TQFileInfo *fi );
|
|
|
|
virtual ~TQtFileIconViewItem();
|
|
|
|
ItemType type() const
|
|
{ return itemType; }
|
|
<a href="tqstring.html">TQString</a> filename() const { return itemFileName; }
|
|
|
|
virtual bool acceptDrop( const <a href="tqmimesource.html">TQMimeSource</a> *e ) const;
|
|
|
|
virtual void setText( const <a href="tqstring.html">TQString</a> &text );
|
|
virtual TQPixmap *pixmap() const;
|
|
|
|
virtual void dragEntered();
|
|
virtual void dragLeft();
|
|
|
|
void viewModeChanged( TQtFileIconView::ViewMode m );
|
|
void paintItem( <a href="tqpainter.html">TQPainter</a> *p, const <a href="tqcolorgroup.html">TQColorGroup</a> &cg );
|
|
|
|
protected:
|
|
virtual void dropped( <a href="tqdropevent.html">TQDropEvent</a> *e, const <a href="tqvaluelist.html">TQValueList</a><TQIconDragItem> & );
|
|
|
|
<a href="tqstring.html">TQString</a> itemFileName;
|
|
<a href="tqfileinfo.html">TQFileInfo</a> *itemFileInfo;
|
|
ItemType itemType;
|
|
bool checkSetText;
|
|
<a href="tqtimer.html">TQTimer</a> timer;
|
|
TQtFileIconView::ViewMode vm;
|
|
|
|
};
|
|
|
|
|
|
#endif
|
|
</pre>
|
|
|
|
<p> <hr>
|
|
<p> Implementation of the file icon view:
|
|
<p> <pre>/****************************************************************************
|
|
** $Id: qt/tqfileiconview.cpp 3.3.8 edited Jan 11 14:37 $
|
|
**
|
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|
**
|
|
** This file is part of an example program for TQt. This example
|
|
** program may be used, distributed and modified without limitation.
|
|
**
|
|
*****************************************************************************/
|
|
|
|
#include "tqfileiconview.h"
|
|
#include <<a href="tqpainter-h.html">tqpainter.h</a>>
|
|
#include <<a href="tqstringlist-h.html">tqstringlist.h</a>>
|
|
#include <<a href="tqpixmap-h.html">tqpixmap.h</a>>
|
|
#include <<a href="tqmime-h.html">tqmime.h</a>>
|
|
#include <<a href="tqstrlist-h.html">tqstrlist.h</a>>
|
|
#include <<a href="tqdragobject-h.html">tqdragobject.h</a>>
|
|
#include <<a href="tqmessagebox-h.html">tqmessagebox.h</a>>
|
|
#include <<a href="tqevent-h.html">tqevent.h</a>>
|
|
#include <<a href="tqpopupmenu-h.html">tqpopupmenu.h</a>>
|
|
#include <<a href="tqcursor-h.html">tqcursor.h</a>>
|
|
#include <<a href="tqapplication-h.html">tqapplication.h</a>>
|
|
#include <<a href="tqwmatrix-h.html">tqwmatrix.h</a>>
|
|
|
|
#include <stdlib.h>
|
|
|
|
static const char * file_icon[]={
|
|
"32 32 17 1",
|
|
"# c #000000",
|
|
"a c #ffffff",
|
|
"j c #808080",
|
|
"n c #a0a0a4",
|
|
"g c #c0c0c0",
|
|
"m c #004000",
|
|
"o c #000000",
|
|
"l c #004040",
|
|
"k c #404000",
|
|
"i c #c0c000",
|
|
"h c #ffff00",
|
|
"b c #ffffc0",
|
|
"e c #ff8000",
|
|
"f c #c05800",
|
|
"c c #ffa858",
|
|
"d c #ffdca8",
|
|
". c None",
|
|
"................................",
|
|
"................................",
|
|
"................................",
|
|
"................................",
|
|
".............#....###...........",
|
|
"...###......#a##.#aba##.........",
|
|
"..#cdb#....#aaaa#aaaaaa##.......",
|
|
"..#ecdb#..#aaaa#aaaaaaaba##.....",
|
|
"..#fecdb##aaaa#aaaaaaaaaaab##...",
|
|
"...#fecdb#aaa#aaaaaaabaabaaaa##.",
|
|
"....#fecdb#a#baaaaa#baaaaaabaaa#",
|
|
".....#fecdb#aaaaab#a##baaaaaaa#.",
|
|
".....##fecdb#bbba#aaaa##baaab#..",
|
|
"....#bb#fecdb#ba#aaaaaaa##aa#...",
|
|
"...#bbbb#fecdb##aaabaaaaaa##....",
|
|
"..#bbbb#b#fecdb#aaaaaaabaaaa##..",
|
|
".#bbbb#bbb#fecdg#aaaaaaaaaaaba#.",
|
|
"#hhbb#bbbbb#fegg#iiaaaaaaaaaaaa#",
|
|
"#jhhhklibbbk#ggj#aaiiaaaaaaaaa#j",
|
|
".#mjhhhkmikab####aaabiiaaaaaa#j.",
|
|
"...##jhhhmaaibbaaiibaaaiiaab#n..",
|
|
".....##j#baaaiiabaaiibaabaa#n...",
|
|
"......##baibaabiibaaaiiabb#j....",
|
|
"......#bbbbiiaabbiiaaaaabon.....",
|
|
".....#bbbbbbbiiabbaiiaab#n......",
|
|
".....#jbbbbbbbbiibaabba#n.......",
|
|
"......##jbbbbbbbbiiaabmj........",
|
|
"........##jbbbbbbbbbb#j.........",
|
|
"..........##nbbbbbbbmj..........",
|
|
"............##jbbbb#j...........",
|
|
"..............#mjj#n............",
|
|
"................##n............."};
|
|
|
|
static const char * folder_icon[]={
|
|
"32 32 11 1",
|
|
"# c #000000",
|
|
"b c #c0c000",
|
|
"d c #585858",
|
|
"a c #ffff00",
|
|
"i c #400000",
|
|
"h c #a0a0a4",
|
|
"e c #000000",
|
|
"c c #ffffff",
|
|
"f c #303030",
|
|
"g c #c0c0c0",
|
|
". c None",
|
|
"...###..........................",
|
|
"...#aa##........................",
|
|
".###baaa##......................",
|
|
".#cde#baaa##....................",
|
|
".#cccdeebaaa##..##f.............",
|
|
".#cccccdeebaaa##aaa##...........",
|
|
".#cccccccdeebaaaaaaaa##.........",
|
|
".#cccccccccdeebababaaa#.........",
|
|
".#cccccgcgghhebbbbbbbaa#........",
|
|
".#ccccccgcgggdebbbbbbba#........",
|
|
".#cccgcgcgcgghdeebiebbba#.......",
|
|
".#ccccgcggggggghdeddeeba#.......",
|
|
".#cgcgcgcggggggggghghdebb#......",
|
|
".#ccgcggggggggghghghghd#b#......",
|
|
".#cgcgcggggggggghghghhd#b#......",
|
|
".#gcggggggggghghghhhhhd#b#......",
|
|
".#cgcggggggggghghghhhhd#b#......",
|
|
".#ggggggggghghghhhhhhhdib#......",
|
|
".#gggggggggghghghhhhhhd#b#......",
|
|
".#hhggggghghghhhhhhhhhd#b#......",
|
|
".#ddhhgggghghghhhhhhhhd#b#......",
|
|
"..##ddhhghghhhhhhhhhhhdeb#......",
|
|
"....##ddhhhghhhhhhhhhhd#b#......",
|
|
"......##ddhhhhhhhhhhhhd#b#......",
|
|
"........##ddhhhhhhhhhhd#b#......",
|
|
"..........##ddhhhhhhhhd#b#......",
|
|
"............##ddhhhhhhd#b###....",
|
|
"..............##ddhhhhd#b#####..",
|
|
"................##ddhhd#b######.",
|
|
"..................##dddeb#####..",
|
|
"....................##d#b###....",
|
|
"......................####......"};
|
|
|
|
|
|
static const char * link_icon[]={
|
|
"32 32 12 1",
|
|
"# c #000000",
|
|
"h c #a0a0a4",
|
|
"b c #c00000",
|
|
"d c #585858",
|
|
"i c #400000",
|
|
"c c #ffffff",
|
|
"e c #000000",
|
|
"g c #c0c0c0",
|
|
"a c #ff0000",
|
|
"f c #303030",
|
|
"n c white",
|
|
". c None",
|
|
"...###..........................",
|
|
"...#aa##........................",
|
|
".###baaa##......................",
|
|
".#cde#baaa##....................",
|
|
".#cccdeebaaa##..##f.............",
|
|
".#cccccdeebaaa##aaa##...........",
|
|
".#cccccccdeebaaaaaaaa##.........",
|
|
".#cccccccccdeebababaaa#.........",
|
|
".#cccccgcgghhebbbbbbbaa#........",
|
|
".#ccccccgcgggdebbbbbbba#........",
|
|
".#cccgcgcgcgghdeebiebbba#.......",
|
|
".#ccccgcggggggghdeddeeba#.......",
|
|
".#cgcgcgcggggggggghghdebb#......",
|
|
".#ccgcggggggggghghghghd#b#......",
|
|
".#cgcgcggggggggghghghhd#b#......",
|
|
".#gcggggggggghghghhhhhd#b#......",
|
|
".#cgcggggggggghghghhhhd#b#......",
|
|
".#ggggggggghghghhhhhhhdib#......",
|
|
".#gggggggggghghghhhhhhd#b#......",
|
|
".#hhggggghghghhhhhhhhhd#b#......",
|
|
".#ddhhgggghghghhhhhhhhd#b#......",
|
|
"..##ddhhghghhhhhhhhhhhdeb#......",
|
|
"############hhhhhhhhhhd#b#......",
|
|
"#nnnnnnnnnn#hhhhhhhhhhd#b#......",
|
|
"#nnnnnnnnnn#hhhhhhhhhhd#b#......",
|
|
"#nn#nn#nnnn#ddhhhhhhhhd#b#......",
|
|
"#nn##n##nnn###ddhhhhhhd#b###....",
|
|
"#nnn#####nn#..##ddhhhhd#b#####..",
|
|
"#nnnnn##nnn#....##ddhhd#b######.",
|
|
"#nnnnn#nnnn#......##dddeb#####..",
|
|
"#nnnnnnnnnn#........##d#b###....",
|
|
"############..........####......"};
|
|
|
|
static const char * folder_locked_icon[]={
|
|
"32 32 12 1",
|
|
"# c #000000",
|
|
"g c #808080",
|
|
"h c #c0c0c0",
|
|
"f c #c05800",
|
|
"c c #ffffff",
|
|
"d c #585858",
|
|
"b c #ffa858",
|
|
"a c #ffdca8",
|
|
"e c #000000",
|
|
"i c #a0a0a4",
|
|
"j c #c0c0c0",
|
|
". c None",
|
|
"...###..........................",
|
|
"...#aa##........................",
|
|
".###baaa##......................",
|
|
".#cde#baaa##....................",
|
|
".#cccdeeba#######...............",
|
|
".#cccccde##fffff##..............",
|
|
".#cccccc##fffgggg#..............",
|
|
".#ccccccc#ffg####a##............",
|
|
".#ccccchc#ffg#eebbaa##..........",
|
|
".#ccccccc#ffg#ddeebbba##........",
|
|
".#ccchccc#ffg#ihddeebbba##......",
|
|
".#cccccaa#ffg#ihhhddeeba##......",
|
|
".#chchhbbaafg#ihhhihidebb#......",
|
|
".#cchccbbbbaa#ihhihihid#b#......",
|
|
".#chchhbb#bbbaaiihihiid#b#......",
|
|
".#hchhcbb#fbbbafhiiiiid#b#......",
|
|
".#chchhbb#ffgbbfihiiiid#b#......",
|
|
".#hhhhhbb#ffg#bfiiiiiid#b#......",
|
|
".#hhhhhbbaffg#bfiiiiiid#b#......",
|
|
".#iihhhjbbaab#bfiiiiiid#b#......",
|
|
".#ddiihhh#bbbabfiiiiiid#b#......",
|
|
"..##ddiih#ffbbbfiiiiiid#b#......",
|
|
"....##ddi#ffg#biiiiiiid#b#......",
|
|
"......##d#ffg#iiiiiiiid#b#......",
|
|
"........##ffg#iiiiiiiid#b#......",
|
|
".........#ffg#iiiiiiiid#b#......",
|
|
".........#ffg#ddiiiiiid#b###....",
|
|
".........##fg###ddiiiid#b#####..",
|
|
"...........####.##ddiid#b######.",
|
|
"..................##dddeb#####..",
|
|
"....................##d#b###....",
|
|
"......................####......"};
|
|
|
|
static TQPixmap *iconFolderLockedLarge = 0;
|
|
static TQPixmap *iconFolderLarge = 0;
|
|
static TQPixmap *iconFileLarge = 0;
|
|
static TQPixmap *iconLinkLarge = 0;
|
|
static TQPixmap *iconFolderLockedSmall = 0;
|
|
static TQPixmap *iconFolderSmall = 0;
|
|
static TQPixmap *iconFileSmall = 0;
|
|
static TQPixmap *iconLinkSmall = 0;
|
|
|
|
static void cleanup()
|
|
{
|
|
delete iconFolderLockedLarge;
|
|
iconFolderLockedLarge = 0;
|
|
delete iconFolderLarge;
|
|
iconFolderLarge = 0;
|
|
delete iconFileLarge;
|
|
iconFileLarge = 0;
|
|
delete iconLinkLarge;
|
|
iconLinkLarge = 0;
|
|
delete iconFolderLockedSmall;
|
|
iconFolderLockedSmall = 0;
|
|
delete iconFolderSmall;
|
|
iconFolderSmall = 0;
|
|
delete iconFileSmall;
|
|
iconFileSmall = 0;
|
|
delete iconLinkSmall;
|
|
iconLinkSmall = 0;
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Class TQtFileIconDrag
|
|
*
|
|
*****************************************************************************/
|
|
|
|
<a name="f301"></a>TQtFileIconDrag::TQtFileIconDrag( <a href="tqwidget.html">TQWidget</a> * dragSource, const char* name )
|
|
: <a href="tqicondrag.html">TQIconDrag</a>( dragSource, name )
|
|
{
|
|
}
|
|
|
|
<a name="x832"></a>const char* TQtFileIconDrag::<a href="tqmimesource.html#format">format</a>( int i ) const
|
|
{
|
|
if ( i == 0 )
|
|
return "application/x-qiconlist";
|
|
else if ( i == 1 )
|
|
return "text/uri-list";
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
<a name="x831"></a>TQByteArray TQtFileIconDrag::<a href="tqicondrag.html#encodedData">encodedData</a>( const char* mime ) const
|
|
{
|
|
<a href="tqbytearray.html">TQByteArray</a> a;
|
|
if ( TQString( mime ) == "application/x-qiconlist" ) {
|
|
a = TQIconDrag::<a href="tqicondrag.html#encodedData">encodedData</a>( mime );
|
|
} else if ( TQString( mime ) == "text/uri-list" ) {
|
|
<a href="tqstring.html">TQString</a> s = urls.join( "\r\n" );
|
|
<a name="x870"></a><a name="x856"></a> a.<a href="tqmemarray.html#resize">resize</a>( s.<a href="tqstring.html#length">length</a>() );
|
|
<a name="x869"></a><a name="x855"></a> memcpy( a.<a href="tqmemarray.html#data">data</a>(), s.<a href="tqstring.html#latin1">latin1</a>(), s.<a href="tqstring.html#length">length</a>() );
|
|
}
|
|
return a;
|
|
}
|
|
|
|
<a name="x830"></a>bool TQtFileIconDrag::<a href="tqicondrag.html#canDecode">canDecode</a>( <a href="tqmimesource.html">TQMimeSource</a>* e )
|
|
{
|
|
<a name="x819"></a> return e-><a href="tqdropevent.html#provides">provides</a>( "application/x-qiconlist" ) ||
|
|
e-><a href="tqdropevent.html#provides">provides</a>( "text/uri-list" );
|
|
}
|
|
|
|
<a name="x829"></a>void TQtFileIconDrag::<a href="tqicondrag.html#append">append</a>( const <a href="tqicondragitem.html">TQIconDragItem</a> &item, const <a href="tqrect.html">TQRect</a> &pr,
|
|
const <a href="tqrect.html">TQRect</a> &tr, const <a href="tqstring.html">TQString</a> &url )
|
|
{
|
|
TQIconDrag::<a href="tqicondrag.html#append">append</a>( item, pr, tr );
|
|
<a href="tqstring.html">TQString</a> ourUrl = url;
|
|
#ifdef TQ_WS_WIN
|
|
if (ourUrl.<a href="tqstring.html#length">length</a>() > 2 && ourUrl[1] != ':') {
|
|
<a href="tqdir.html">TQDir</a> dir(ourUrl);
|
|
<a name="x810"></a> ourUrl = dir.<a href="tqdir.html#absPath">absPath</a>();
|
|
}
|
|
#endif
|
|
urls << TQUriDrag::<a href="tquridrag.html#localFileToUri">localFileToUri</a>(ourUrl);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Class TQtFileIconViewItem
|
|
*
|
|
*****************************************************************************/
|
|
|
|
<a name="f322"></a>TQtFileIconViewItem::TQtFileIconViewItem( TQtFileIconView *parent, TQFileInfo *fi )
|
|
<a name="x824"></a><a name="x823"></a> : <a href="tqiconviewitem.html">TQIconViewItem</a>( parent, fi-><a href="tqfileinfo.html#fileName">fileName</a>() ), itemFileName( fi-><a href="tqfileinfo.html#filePath">filePath</a>() ),
|
|
itemFileInfo( fi ), checkSetText( FALSE )
|
|
{
|
|
vm = TQtFileIconView::Large;
|
|
|
|
<a name="x825"></a> if ( itemFileInfo-><a href="tqfileinfo.html#isDir">isDir</a>() )
|
|
itemType = Dir;
|
|
<a name="x826"></a> else if ( itemFileInfo-><a href="tqfileinfo.html#isFile">isFile</a>() )
|
|
itemType = File;
|
|
<a name="x827"></a> if ( itemFileInfo-><a href="tqfileinfo.html#isSymLink">isSymLink</a>() )
|
|
itemType = Link;
|
|
|
|
viewModeChanged( ( (TQtFileIconView*)<a href="tqiconviewitem.html#iconView">iconView</a>() )->viewMode() );
|
|
|
|
if ( itemFileInfo-><a href="tqfileinfo.html#fileName">fileName</a>() == "." ||
|
|
itemFileInfo-><a href="tqfileinfo.html#fileName">fileName</a>() == ".." )
|
|
<a href="tqiconviewitem.html#setRenameEnabled">setRenameEnabled</a>( FALSE );
|
|
|
|
checkSetText = TRUE;
|
|
|
|
TQObject::<a href="tqobject.html#connect">connect</a>( &timer, TQ_SIGNAL( timeout() ),
|
|
<a href="tqiconviewitem.html#iconView">iconView</a>(), TQ_SLOT( openFolder() ) );
|
|
}
|
|
|
|
<a name="x842"></a>void TQtFileIconViewItem::<a href="tqiconviewitem.html#paintItem">paintItem</a>( <a href="tqpainter.html">TQPainter</a> *p, const <a href="tqcolorgroup.html">TQColorGroup</a> &cg )
|
|
{
|
|
if ( itemFileInfo-><a href="tqfileinfo.html#isSymLink">isSymLink</a>() ) {
|
|
<a name="x861"></a> <a href="tqfont.html">TQFont</a> f( p-><a href="tqpainter.html#font">font</a>() );
|
|
<a name="x828"></a> f.<a href="tqfont.html#setItalic">setItalic</a>( TRUE );
|
|
p-><a href="tqpainter.html#setFont">setFont</a>( f );
|
|
}
|
|
|
|
TQIconViewItem::<a href="tqiconviewitem.html#paintItem">paintItem</a>( p, cg );
|
|
}
|
|
|
|
void <a name="f323"></a>TQtFileIconViewItem::viewModeChanged( TQtFileIconView::ViewMode m )
|
|
{
|
|
vm = m;
|
|
<a href="tqiconviewitem.html#setDropEnabled">setDropEnabled</a>( itemType == Dir && TQDir( itemFileName ).isReadable() );
|
|
<a href="tqiconviewitem.html#calcRect">calcRect</a>();
|
|
}
|
|
|
|
<a name="x843"></a>TQPixmap *TQtFileIconViewItem::<a href="tqiconviewitem.html#pixmap">pixmap</a>() const
|
|
{
|
|
switch ( itemType ) {
|
|
case Dir:
|
|
{
|
|
if ( !TQDir( itemFileName ).isReadable() ) {
|
|
if ( vm == TQtFileIconView::Small )
|
|
return iconFolderLockedSmall;
|
|
else
|
|
return iconFolderLockedLarge;
|
|
} else {
|
|
if ( vm == TQtFileIconView::Small )
|
|
return iconFolderSmall;
|
|
else
|
|
return iconFolderLarge;
|
|
}
|
|
}
|
|
case Link:
|
|
{
|
|
if ( vm == TQtFileIconView::Small )
|
|
return iconLinkSmall;
|
|
else
|
|
return iconLinkLarge;
|
|
}
|
|
default:
|
|
{
|
|
if ( vm == TQtFileIconView::Small )
|
|
return iconFileSmall;
|
|
else
|
|
return iconFileLarge;
|
|
}
|
|
}
|
|
}
|
|
|
|
TQtFileIconViewItem::~TQtFileIconViewItem()
|
|
{
|
|
delete itemFileInfo;
|
|
}
|
|
|
|
<a name="x850"></a>void TQtFileIconViewItem::<a href="tqiconviewitem.html#setText">setText</a>( const <a href="tqstring.html">TQString</a> &text )
|
|
{
|
|
if ( checkSetText ) {
|
|
if ( text == "." || text == "." || text.<a href="tqstring.html#isEmpty">isEmpty</a>() )
|
|
return;
|
|
<a name="x821"></a> <a href="tqdir.html">TQDir</a> dir( itemFileInfo-><a href="tqfileinfo.html#dir">dir</a>() );
|
|
<a name="x814"></a> if ( dir.<a href="tqdir.html#rename">rename</a>( itemFileInfo-><a href="tqfileinfo.html#fileName">fileName</a>(), text ) ) {
|
|
<a name="x822"></a> itemFileName = itemFileInfo-><a href="tqfileinfo.html#dirPath">dirPath</a>( TRUE ) + "/" + text;
|
|
delete itemFileInfo;
|
|
itemFileInfo = new <a href="tqfileinfo.html">TQFileInfo</a>( itemFileName );
|
|
TQIconViewItem::<a href="tqiconviewitem.html#setText">setText</a>( text );
|
|
}
|
|
} else {
|
|
TQIconViewItem::<a href="tqiconviewitem.html#setText">setText</a>( text );
|
|
}
|
|
}
|
|
|
|
<a name="x836"></a>bool TQtFileIconViewItem::<a href="tqiconviewitem.html#acceptDrop">acceptDrop</a>( const <a href="tqmimesource.html">TQMimeSource</a> *e ) const
|
|
{
|
|
if ( type() == Dir && e-><a href="tqdropevent.html#provides">provides</a>( "text/uri-list" ) &&
|
|
dropEnabled() )
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
<a name="x839"></a>void TQtFileIconViewItem::<a href="tqiconviewitem.html#dropped">dropped</a>( <a href="tqdropevent.html">TQDropEvent</a> *e, const <a href="tqvaluelist.html">TQValueList</a><TQIconDragItem> & )
|
|
{
|
|
timer.stop();
|
|
|
|
if ( !TQUriDrag::canDecode( e ) ) {
|
|
<a name="x818"></a> e-><a href="tqdropevent.html#ignore">ignore</a>();
|
|
return;
|
|
}
|
|
|
|
<a href="tqstringlist.html">TQStringList</a> lst;
|
|
<a name="x873"></a> TQUriDrag::<a href="tquridrag.html#decodeLocalFiles">decodeLocalFiles</a>( e, lst );
|
|
|
|
<a href="tqstring.html">TQString</a> str;
|
|
<a name="x817"></a> if ( e-><a href="tqdropevent.html#action">action</a>() == TQDropEvent::Copy )
|
|
str = "Copy\n\n";
|
|
else
|
|
str = "Move\n\n";
|
|
<a name="x874"></a> for ( uint i = 0; i < lst.<a href="tqvaluelist.html#count">count</a>(); ++i )
|
|
str += TQString( " %1\n" ).arg( lst[i] );
|
|
str += TQString( "\n"
|
|
"To\n\n"
|
|
" %1" ).arg( filename() );
|
|
|
|
<a name="x859"></a> TQMessageBox::<a href="tqmessagebox.html#information">information</a>( iconView(), e-><a href="tqdropevent.html#action">action</a>() == TQDropEvent::Copy ? "Copy" : "Move" , str, "Not Implemented" );
|
|
if ( e-><a href="tqdropevent.html#action">action</a>() == TQDropEvent::Move )
|
|
TQMessageBox::<a href="tqmessagebox.html#information">information</a>( iconView(), "Remove" , str, "Not Implemented" );
|
|
<a name="x816"></a> e-><a href="tqdropevent.html#acceptAction">acceptAction</a>();
|
|
}
|
|
|
|
<a name="x837"></a>void TQtFileIconViewItem::<a href="tqiconviewitem.html#dragEntered">dragEntered</a>()
|
|
{
|
|
if ( type() != Dir ||
|
|
type() == Dir && !TQDir( itemFileName ).isReadable() )
|
|
return;
|
|
|
|
( (TQtFileIconView*)iconView() )->setOpenItem( this );
|
|
timer.start( 1500 );
|
|
}
|
|
|
|
<a name="x838"></a>void TQtFileIconViewItem::<a href="tqiconviewitem.html#dragLeft">dragLeft</a>()
|
|
{
|
|
if ( type() != Dir ||
|
|
type() == Dir && !TQDir( itemFileName ).isReadable() )
|
|
return;
|
|
|
|
timer.stop();
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Class TQtFileIconView
|
|
*
|
|
*****************************************************************************/
|
|
|
|
<a name="f302"></a>TQtFileIconView::TQtFileIconView( const <a href="tqstring.html">TQString</a> &dir, TQWidget *parent, const char *name )
|
|
: <a href="tqiconview.html">TQIconView</a>( parent, name ), viewDir( dir ), newFolderNum( 0 )
|
|
{
|
|
if ( !iconFolderLockedLarge ) {
|
|
<a href="tqapplication.html#qAddPostRoutine">tqAddPostRoutine</a>( cleanup );
|
|
<a href="tqwmatrix.html">TQWMatrix</a> m;
|
|
<a name="x876"></a> m.<a href="tqwmatrix.html#scale">scale</a>( 0.6, 0.6 );
|
|
<a href="tqpixmap.html">TQPixmap</a> iconpix( folder_locked_icon );
|
|
iconFolderLockedLarge = new <a href="tqpixmap.html">TQPixmap</a>( folder_locked_icon );
|
|
<a name="x863"></a> iconpix = iconpix.<a href="tqpixmap.html#xForm">xForm</a>( m );
|
|
iconFolderLockedSmall = new <a href="tqpixmap.html">TQPixmap</a>( iconpix );
|
|
iconpix = TQPixmap( folder_icon );
|
|
iconFolderLarge = new <a href="tqpixmap.html">TQPixmap</a>( folder_icon );
|
|
iconpix = iconpix.<a href="tqpixmap.html#xForm">xForm</a>( m );
|
|
iconFolderSmall = new <a href="tqpixmap.html">TQPixmap</a>( iconpix );
|
|
iconpix = TQPixmap( file_icon );
|
|
iconFileLarge = new <a href="tqpixmap.html">TQPixmap</a>( file_icon );
|
|
iconpix = iconpix.<a href="tqpixmap.html#xForm">xForm</a>( m );
|
|
iconFileSmall = new <a href="tqpixmap.html">TQPixmap</a>( iconpix );
|
|
iconpix = TQPixmap( link_icon );
|
|
iconLinkLarge = new <a href="tqpixmap.html">TQPixmap</a>( link_icon );
|
|
iconpix = iconpix.<a href="tqpixmap.html#xForm">xForm</a>( m );
|
|
iconLinkSmall = new <a href="tqpixmap.html">TQPixmap</a>( iconpix );
|
|
}
|
|
|
|
vm = Large;
|
|
|
|
<a href="tqiconview.html#setGridX">setGridX</a>( 75 );
|
|
<a href="tqiconview.html#setResizeMode">setResizeMode</a>( Adjust );
|
|
<a href="tqiconview.html#setWordWrapIconText">setWordWrapIconText</a>( FALSE );
|
|
|
|
<a href="tqobject.html#connect">connect</a>( this, TQ_SIGNAL( <a href="tqiconview.html#doubleClicked">doubleClicked</a>( <a href="tqiconviewitem.html">TQIconViewItem</a> * ) ),
|
|
this, TQ_SLOT( itemDoubleClicked( <a href="tqiconviewitem.html">TQIconViewItem</a> * ) ) );
|
|
<a href="tqobject.html#connect">connect</a>( this, TQ_SIGNAL( <a href="tqiconview.html#returnPressed">returnPressed</a>( <a href="tqiconviewitem.html">TQIconViewItem</a> * ) ),
|
|
this, TQ_SLOT( itemDoubleClicked( <a href="tqiconviewitem.html">TQIconViewItem</a> * ) ) );
|
|
<a href="tqobject.html#connect">connect</a>( this, TQ_SIGNAL( <a href="tqiconview.html#dropped">dropped</a>( <a href="tqdropevent.html">TQDropEvent</a> *, const <a href="tqvaluelist.html">TQValueList</a><TQIconDragItem> & ) ),
|
|
this, TQ_SLOT( slotDropped( <a href="tqdropevent.html">TQDropEvent</a> *, const <a href="tqvaluelist.html">TQValueList</a><TQIconDragItem> & ) ) );
|
|
<a href="tqobject.html#connect">connect</a>( this, TQ_SIGNAL( <a href="tqiconview.html#contextMenuRequested">contextMenuRequested</a>( <a href="tqiconviewitem.html">TQIconViewItem</a> *, const <a href="tqpoint.html">TQPoint</a> & ) ),
|
|
this, TQ_SLOT( slotRightPressed( <a href="tqiconviewitem.html">TQIconViewItem</a> * ) ) );
|
|
|
|
<a href="tqscrollview.html#setHScrollBarMode">setHScrollBarMode</a>( AlwaysOff );
|
|
<a href="tqscrollview.html#setVScrollBarMode">setVScrollBarMode</a>( Auto );
|
|
|
|
<a href="tqiconview.html#setAutoArrange">setAutoArrange</a>( TRUE );
|
|
<a href="tqiconview.html#setSorting">setSorting</a>( TRUE );
|
|
openItem = 0;
|
|
}
|
|
|
|
void <a name="f303"></a>TQtFileIconView::openFolder()
|
|
{
|
|
if ( !openItem )
|
|
return;
|
|
if ( openItem->type() != TQtFileIconViewItem::Dir ||
|
|
openItem->type() == TQtFileIconViewItem::Dir &&
|
|
!TQDir( openItem->itemFileName ).isReadable() )
|
|
return;
|
|
|
|
openItem->timer.stop();
|
|
setDirectory( openItem->itemFileName );
|
|
}
|
|
|
|
void <a name="f304"></a>TQtFileIconView::setDirectory( const <a href="tqstring.html">TQString</a> &dir )
|
|
{
|
|
viewDir = TQDir( dir );
|
|
readDir( viewDir );
|
|
}
|
|
|
|
void TQtFileIconView::setDirectory( const <a href="tqdir.html">TQDir</a> &dir )
|
|
{
|
|
viewDir = dir;
|
|
readDir( viewDir );
|
|
}
|
|
|
|
void <a name="f305"></a>TQtFileIconView::newDirectory()
|
|
{
|
|
<a href="tqiconview.html#setAutoArrange">setAutoArrange</a>( FALSE );
|
|
<a href="tqiconview.html#selectAll">selectAll</a>( FALSE );
|
|
if ( viewDir.mkdir( TQString( "New Folder %1" ).arg( ++newFolderNum ) ) ) {
|
|
<a href="tqfileinfo.html">TQFileInfo</a> *fi = new <a href="tqfileinfo.html">TQFileInfo</a>( viewDir, TQString( "New Folder %1" ).arg( newFolderNum ) );
|
|
TQtFileIconViewItem *item = new TQtFileIconViewItem( this, new <a href="tqfileinfo.html">TQFileInfo</a>( *fi ) );
|
|
<a name="x847"></a> item-><a href="tqiconviewitem.html#setKey">setKey</a>( TQString( "000000%1" ).arg( fi-><a href="tqfileinfo.html#fileName">fileName</a>() ) );
|
|
delete fi;
|
|
<a href="tqscrollview.html#repaintContents">repaintContents</a>( <a href="tqscrollview.html#contentsX">contentsX</a>(), contentsY(), contentsWidth(), contentsHeight(), FALSE );
|
|
<a href="tqiconview.html#ensureItemVisible">ensureItemVisible</a>( item );
|
|
<a name="x849"></a> item-><a href="tqiconviewitem.html#setSelected">setSelected</a>( TRUE, TRUE );
|
|
<a href="tqiconview.html#setCurrentItem">setCurrentItem</a>( item );
|
|
<a href="tqiconview.html#repaintItem">repaintItem</a>( item );
|
|
<a name="x808"></a> tqApp-><a href="tqapplication.html#processEvents">processEvents</a>();
|
|
<a name="x845"></a> item-><a href="tqiconviewitem.html#rename">rename</a>();
|
|
}
|
|
<a href="tqiconview.html#setAutoArrange">setAutoArrange</a>( TRUE );
|
|
}
|
|
|
|
TQDir <a name="f306"></a>TQtFileIconView::currentDir()
|
|
{
|
|
return viewDir;
|
|
}
|
|
|
|
static bool isRoot( const <a href="tqstring.html">TQString</a> &s )
|
|
{
|
|
#if defined(Q_OS_UNIX)
|
|
if ( s == "/" )
|
|
return TRUE;
|
|
#elif defined(Q_OS_WIN32)
|
|
<a href="tqstring.html">TQString</a> p = s;
|
|
if ( p.<a href="tqstring.html#length">length</a>() == 3 &&
|
|
<a name="x871"></a> p.<a href="tqstring.html#right">right</a>( 2 ) == ":/" )
|
|
return TRUE;
|
|
if ( p[ 0 ] == '/' && p[ 1 ] == '/' ) {
|
|
<a name="x867"></a> int slashes = p.<a href="tqstring.html#contains">contains</a>( '/' );
|
|
if ( slashes <= 3 )
|
|
return TRUE;
|
|
if ( slashes == 4 && p[ (int)p.<a href="tqstring.html#length">length</a>() - 1 ] == '/' )
|
|
return TRUE;
|
|
}
|
|
#endif
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void <a name="f307"></a>TQtFileIconView::readDir( const <a href="tqdir.html">TQDir</a> &dir )
|
|
{
|
|
<a name="x813"></a> if ( !dir.<a href="tqdir.html#isReadable">isReadable</a>() )
|
|
return;
|
|
|
|
if ( isRoot( dir.<a href="tqdir.html#absPath">absPath</a>() ) )
|
|
emit disableUp();
|
|
else
|
|
emit enableUp();
|
|
|
|
<a href="tqiconview.html#clear">clear</a>();
|
|
|
|
emit directoryChanged( dir.<a href="tqdir.html#absPath">absPath</a>() );
|
|
|
|
<a name="x812"></a> const TQFileInfoList *filist = dir.<a href="tqdir.html#entryInfoList">entryInfoList</a>( TQDir::DefaultFilter, TQDir::DirsFirst | TQDir::Name );
|
|
|
|
emit startReadDir( filist->count() );
|
|
|
|
TQFileInfoListIterator it( *filist );
|
|
<a href="tqfileinfo.html">TQFileInfo</a> *fi;
|
|
bool allowRename = FALSE, allowRenameSet = FALSE;
|
|
while ( ( fi = it.current() ) != 0 ) {
|
|
++it;
|
|
if ( fi && fi-><a href="tqfileinfo.html#fileName">fileName</a>() == ".." && ( fi-><a href="tqfileinfo.html#dirPath">dirPath</a>() == "/" || fi-><a href="tqfileinfo.html#dirPath">dirPath</a>().isEmpty() ) )
|
|
continue;
|
|
emit readNextDir();
|
|
TQtFileIconViewItem *item = new TQtFileIconViewItem( this, new <a href="tqfileinfo.html">TQFileInfo</a>( *fi ) );
|
|
if ( fi-><a href="tqfileinfo.html#isDir">isDir</a>() )
|
|
item-><a href="tqiconviewitem.html#setKey">setKey</a>( TQString( "000000%1" ).arg( fi-><a href="tqfileinfo.html#fileName">fileName</a>() ) );
|
|
else
|
|
item-><a href="tqiconviewitem.html#setKey">setKey</a>( fi-><a href="tqfileinfo.html#fileName">fileName</a>() );
|
|
if ( !allowRenameSet ) {
|
|
<a name="x820"></a> if ( !TQFileInfo( fi-><a href="tqfileinfo.html#absFilePath">absFilePath</a>() ).isWritable() ||
|
|
<a name="x851"></a> item-><a href="tqiconviewitem.html#text">text</a>() == "." || item-><a href="tqiconviewitem.html#text">text</a>() == ".." )
|
|
allowRename = FALSE;
|
|
else
|
|
allowRename = TRUE;
|
|
if ( item-><a href="tqiconviewitem.html#text">text</a>() == "." || item-><a href="tqiconviewitem.html#text">text</a>() == ".." )
|
|
allowRenameSet = FALSE;
|
|
else
|
|
allowRenameSet = TRUE;
|
|
}
|
|
<a name="x848"></a> item-><a href="tqiconviewitem.html#setRenameEnabled">setRenameEnabled</a>( allowRename );
|
|
}
|
|
|
|
if ( !TQFileInfo( dir.<a href="tqdir.html#absPath">absPath</a>() ).isWritable() )
|
|
emit disableMkdir();
|
|
else
|
|
emit enableMkdir();
|
|
|
|
emit readDirDone();
|
|
}
|
|
|
|
void <a name="f308"></a>TQtFileIconView::itemDoubleClicked( <a href="tqiconviewitem.html">TQIconViewItem</a> *i )
|
|
{
|
|
TQtFileIconViewItem *item = ( TQtFileIconViewItem* )i;
|
|
|
|
if ( item->type() == TQtFileIconViewItem::Dir ) {
|
|
viewDir = TQDir( item->filename() );
|
|
readDir( viewDir );
|
|
} else if ( item->type() == TQtFileIconViewItem::Link &&
|
|
TQFileInfo( TQFileInfo( item->filename() ).readLink() ).isDir() ) {
|
|
viewDir = TQDir( TQFileInfo( item->filename() ).readLink() );
|
|
readDir( viewDir );
|
|
}
|
|
}
|
|
|
|
<a name="x834"></a>TQDragObject *TQtFileIconView::<a href="tqiconview.html#dragObject">dragObject</a>()
|
|
{
|
|
if ( !currentItem() )
|
|
return 0;
|
|
|
|
<a name="x809"></a> <a href="tqpoint.html">TQPoint</a> orig = <a href="tqscrollview.html#viewportToContents">viewportToContents</a>( <a href="tqscrollview.html#viewport">viewport</a>()->mapFromGlobal( TQCursor::<a href="tqcursor.html#pos">pos</a>() ) );
|
|
TQtFileIconDrag *drag = new TQtFileIconDrag( <a href="tqscrollview.html#viewport">viewport</a>() );
|
|
<a name="x815"></a> drag-><a href="tqdragobject.html#setPixmap">setPixmap</a>( *currentItem()->pixmap(),
|
|
TQPoint( <a href="tqiconview.html#currentItem">currentItem</a>()->pixmapRect().width() / 2, currentItem()->pixmapRect().height() / 2 ) );
|
|
for ( TQtFileIconViewItem *item = (TQtFileIconViewItem*)<a href="tqiconview.html#firstItem">firstItem</a>(); item;
|
|
<a name="x841"></a> item = (TQtFileIconViewItem*)item-><a href="tqiconviewitem.html#nextItem">nextItem</a>() ) {
|
|
<a name="x840"></a> if ( item-><a href="tqiconviewitem.html#isSelected">isSelected</a>() ) {
|
|
<a href="tqicondragitem.html">TQIconDragItem</a> id;
|
|
<a name="x833"></a> id.<a href="tqicondragitem.html#setData">setData</a>( TQCString( item->filename() ) );
|
|
drag-><a href="tqicondrag.html#append">append</a>( id,
|
|
<a name="x864"></a><a name="x844"></a> TQRect( item-><a href="tqiconviewitem.html#pixmapRect">pixmapRect</a>( FALSE ).x() - orig.<a href="tqpoint.html#x">x</a>(),
|
|
<a name="x865"></a> item-><a href="tqiconviewitem.html#pixmapRect">pixmapRect</a>( FALSE ).y() - orig.<a href="tqpoint.html#y">y</a>(),
|
|
item-><a href="tqiconviewitem.html#pixmapRect">pixmapRect</a>().width(), item-><a href="tqiconviewitem.html#pixmapRect">pixmapRect</a>().height() ),
|
|
<a name="x852"></a> TQRect( item-><a href="tqiconviewitem.html#textRect">textRect</a>( FALSE ).x() - orig.<a href="tqpoint.html#x">x</a>(),
|
|
item-><a href="tqiconviewitem.html#textRect">textRect</a>( FALSE ).y() - orig.<a href="tqpoint.html#y">y</a>(),
|
|
item-><a href="tqiconviewitem.html#textRect">textRect</a>().width(), item-><a href="tqiconviewitem.html#textRect">textRect</a>().height() ),
|
|
TQString( item->filename() ) );
|
|
}
|
|
}
|
|
|
|
return drag;
|
|
}
|
|
|
|
<a name="x835"></a>void TQtFileIconView::<a href="tqwidget.html#keyPressEvent">keyPressEvent</a>( <a href="tqkeyevent.html">TQKeyEvent</a> *e )
|
|
{
|
|
<a name="x853"></a> if ( e-><a href="tqkeyevent.html#key">key</a>() == Key_N &&
|
|
<a name="x854"></a> ( e-><a href="tqkeyevent.html#state">state</a>() & ControlButton ) )
|
|
newDirectory();
|
|
else
|
|
TQIconView::<a href="tqwidget.html#keyPressEvent">keyPressEvent</a>( e );
|
|
}
|
|
|
|
void <a name="f309"></a>TQtFileIconView::slotDropped( <a href="tqdropevent.html">TQDropEvent</a> *e, const <a href="tqvaluelist.html">TQValueList</a><TQIconDragItem> & )
|
|
{
|
|
if ( openItem )
|
|
openItem->timer.stop();
|
|
if ( !TQUriDrag::canDecode( e ) ) {
|
|
e-><a href="tqdropevent.html#ignore">ignore</a>();
|
|
return;
|
|
}
|
|
|
|
<a href="tqstringlist.html">TQStringList</a> lst;
|
|
TQUriDrag::<a href="tquridrag.html#decodeLocalFiles">decodeLocalFiles</a>( e, lst );
|
|
|
|
<a href="tqstring.html">TQString</a> str;
|
|
if ( e-><a href="tqdropevent.html#action">action</a>() == TQDropEvent::Copy )
|
|
str = "Copy\n\n";
|
|
else
|
|
str = "Move\n\n";
|
|
for ( uint i = 0; i < lst.<a href="tqvaluelist.html#count">count</a>(); ++i )
|
|
<a name="x811"></a> str += TQString( " %1\n" ).arg( TQDir::<a href="tqdir.html#convertSeparators">convertSeparators</a>(lst[i]) );
|
|
str += TQString( "\n"
|
|
"To\n\n"
|
|
" %1" ).arg( viewDir.absPath() );
|
|
|
|
TQMessageBox::<a href="tqmessagebox.html#information">information</a>( this, e-><a href="tqdropevent.html#action">action</a>() == TQDropEvent::Copy ? "Copy" : "Move" , str, "Not Implemented" );
|
|
if ( e-><a href="tqdropevent.html#action">action</a>() == TQDropEvent::Move )
|
|
<a name="x872"></a> TQMessageBox::<a href="tqmessagebox.html#information">information</a>( this, "Remove" , TQDir::convertSeparators(lst.<a href="tqstringlist.html#join">join</a>("\n")), "Not Implemented" );
|
|
e-><a href="tqdropevent.html#acceptAction">acceptAction</a>();
|
|
openItem = 0;
|
|
}
|
|
|
|
void <a name="f310"></a>TQtFileIconView::viewLarge()
|
|
{
|
|
setViewMode( Large );
|
|
}
|
|
|
|
void <a name="f311"></a>TQtFileIconView::viewSmall()
|
|
{
|
|
setViewMode( Small );
|
|
}
|
|
|
|
void <a name="f312"></a>TQtFileIconView::viewBottom()
|
|
{
|
|
<a href="tqiconview.html#setItemTextPos">setItemTextPos</a>( Bottom );
|
|
}
|
|
|
|
void <a name="f313"></a>TQtFileIconView::viewRight()
|
|
{
|
|
<a href="tqiconview.html#setItemTextPos">setItemTextPos</a>( Right );
|
|
}
|
|
|
|
void <a name="f314"></a>TQtFileIconView::flowEast()
|
|
{
|
|
<a href="tqscrollview.html#setHScrollBarMode">setHScrollBarMode</a>( AlwaysOff );
|
|
<a href="tqscrollview.html#setVScrollBarMode">setVScrollBarMode</a>( Auto );
|
|
<a href="tqiconview.html#setArrangement">setArrangement</a>( LeftToRight );
|
|
}
|
|
|
|
void <a name="f315"></a>TQtFileIconView::flowSouth()
|
|
{
|
|
<a href="tqscrollview.html#setVScrollBarMode">setVScrollBarMode</a>( AlwaysOff );
|
|
<a href="tqscrollview.html#setHScrollBarMode">setHScrollBarMode</a>( Auto );
|
|
<a href="tqiconview.html#setArrangement">setArrangement</a>( TopToBottom );
|
|
}
|
|
|
|
void <a name="f316"></a>TQtFileIconView::sortAscending()
|
|
{
|
|
<a href="tqiconview.html#sort">sort</a>( TRUE );
|
|
}
|
|
|
|
void <a name="f317"></a>TQtFileIconView::sortDescending()
|
|
{
|
|
<a href="tqiconview.html#sort">sort</a>( FALSE );
|
|
}
|
|
|
|
void <a name="f318"></a>TQtFileIconView::itemTextTruncate()
|
|
{
|
|
<a href="tqiconview.html#setWordWrapIconText">setWordWrapIconText</a>( FALSE );
|
|
}
|
|
|
|
void <a name="f319"></a>TQtFileIconView::itemTextWordWrap()
|
|
{
|
|
<a href="tqiconview.html#setWordWrapIconText">setWordWrapIconText</a>( TRUE );
|
|
}
|
|
|
|
void <a name="f320"></a>TQtFileIconView::slotRightPressed( <a href="tqiconviewitem.html">TQIconViewItem</a> *item )
|
|
{
|
|
if ( !item ) { // right pressed on viewport
|
|
<a href="tqpopupmenu.html">TQPopupMenu</a> menu( this );
|
|
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "&Large view", this, TQ_SLOT( viewLarge() ) );
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "&Small view", this, TQ_SLOT( viewSmall() ) );
|
|
menu.<a href="tqmenudata.html#insertSeparator">insertSeparator</a>();
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Text at the &bottom", this, TQ_SLOT( viewBottom() ) );
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Text at the &right", this, TQ_SLOT( viewRight() ) );
|
|
menu.<a href="tqmenudata.html#insertSeparator">insertSeparator</a>();
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Arrange l&eft to right", this, TQ_SLOT( flowEast() ) );
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Arrange t&op to bottom", this, TQ_SLOT( flowSouth() ) );
|
|
menu.<a href="tqmenudata.html#insertSeparator">insertSeparator</a>();
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "&Truncate item text", this, TQ_SLOT( itemTextTruncate() ) );
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "&Wordwrap item text", this, TQ_SLOT( itemTextWordWrap() ) );
|
|
menu.<a href="tqmenudata.html#insertSeparator">insertSeparator</a>();
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Arrange items in &grid", this, TQ_SLOT( <a href="tqiconview.html#arrangeItemsInGrid">arrangeItemsInGrid</a>() ) );
|
|
menu.<a href="tqmenudata.html#insertSeparator">insertSeparator</a>();
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Sort &ascending", this, TQ_SLOT( sortAscending() ) );
|
|
menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Sort &descending", this, TQ_SLOT( sortDescending() ) );
|
|
|
|
<a name="x875"></a> menu.<a href="tqwidget.html#setMouseTracking">setMouseTracking</a>( TRUE );
|
|
<a name="x866"></a> menu.<a href="tqpopupmenu.html#exec">exec</a>( TQCursor::<a href="tqcursor.html#pos">pos</a>() );
|
|
} else { // on item
|
|
<a href="tqpopupmenu.html">TQPopupMenu</a> menu( this );
|
|
|
|
int RENAME_ITEM = menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Rename Item" );
|
|
int REMOVE_ITEM = menu.<a href="tqmenudata.html#insertItem">insertItem</a>( "Remove Item" );
|
|
|
|
menu.<a href="tqwidget.html#setMouseTracking">setMouseTracking</a>( TRUE );
|
|
int id = menu.<a href="tqpopupmenu.html#exec">exec</a>( TQCursor::<a href="tqcursor.html#pos">pos</a>() );
|
|
|
|
if ( id == -1 )
|
|
return;
|
|
|
|
<a name="x846"></a> if ( id == RENAME_ITEM && item-><a href="tqiconviewitem.html#renameEnabled">renameEnabled</a>() ) {
|
|
item-><a href="tqiconviewitem.html#rename">rename</a>();
|
|
} else if ( id == REMOVE_ITEM ) {
|
|
delete item;
|
|
TQMessageBox::<a href="tqmessagebox.html#information">information</a>( this, "Not implemented!", "Deleting files not implemented yet,\n"
|
|
"The item has only been removed from the view! " );
|
|
}
|
|
}
|
|
}
|
|
|
|
void <a name="f321"></a>TQtFileIconView::setViewMode( ViewMode m )
|
|
{
|
|
if ( m == vm )
|
|
return;
|
|
|
|
vm = m;
|
|
TQtFileIconViewItem *item = (TQtFileIconViewItem*)<a href="tqiconview.html#firstItem">firstItem</a>();
|
|
for ( ; item; item = (TQtFileIconViewItem*)item-><a href="tqiconviewitem.html#nextItem">nextItem</a>() )
|
|
item->viewModeChanged( vm );
|
|
|
|
<a href="tqiconview.html#arrangeItemsInGrid">arrangeItemsInGrid</a>();
|
|
}
|
|
</pre>
|
|
|
|
<p> <hr>
|
|
<p> Header file of the main window:
|
|
<p> <pre>/****************************************************************************
|
|
** $Id: qt/mainwindow.h 3.3.8 edited Jan 11 14:37 $
|
|
**
|
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|
**
|
|
** This file is part of an example program for TQt. This example
|
|
** program may be used, distributed and modified without limitation.
|
|
**
|
|
*****************************************************************************/
|
|
|
|
#ifndef MAINWIN_H
|
|
#define MAINWIN_H
|
|
|
|
#include <<a href="tqmainwindow-h.html">tqmainwindow.h</a>>
|
|
|
|
class TQtFileIconView;
|
|
class DirectoryView;
|
|
class TQProgressBar;
|
|
class TQLabel;
|
|
class TQComboBox;
|
|
class TQToolButton;
|
|
|
|
class FileMainWindow : public <a href="tqmainwindow.html">TQMainWindow</a>
|
|
{
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
FileMainWindow();
|
|
|
|
TQtFileIconView *fileView() { return fileview; }
|
|
DirectoryView *dirList() { return dirlist; }
|
|
|
|
void show();
|
|
|
|
protected:
|
|
void setup();
|
|
void setPathCombo();
|
|
|
|
TQtFileIconView *fileview;
|
|
DirectoryView *dirlist;
|
|
<a href="tqprogressbar.html">TQProgressBar</a> *progress;
|
|
<a href="tqlabel.html">TQLabel</a> *label;
|
|
<a href="tqcombobox.html">TQComboBox</a> *pathCombo;
|
|
<a href="tqtoolbutton.html">TQToolButton</a> *upButton, *mkdirButton;
|
|
|
|
protected slots:
|
|
void directoryChanged( const <a href="tqstring.html">TQString</a> & );
|
|
void slotStartReadDir( int dirs );
|
|
void slotReadNextDir();
|
|
void slotReadDirDone();
|
|
void cdUp();
|
|
void newFolder();
|
|
void changePath( const <a href="tqstring.html">TQString</a> &path );
|
|
void enableUp();
|
|
void disableUp();
|
|
void enableMkdir();
|
|
void disableMkdir();
|
|
|
|
};
|
|
|
|
#endif
|
|
</pre>
|
|
|
|
<p> <hr>
|
|
<p> Implementation of the main window:
|
|
<p> <pre>/****************************************************************************
|
|
** $Id: qt/mainwindow.cpp 3.3.8 edited Jan 11 14:37 $
|
|
**
|
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|
**
|
|
** This file is part of an example program for TQt. This example
|
|
** program may be used, distributed and modified without limitation.
|
|
**
|
|
*****************************************************************************/
|
|
|
|
#include "mainwindow.h"
|
|
#include "tqfileiconview.h"
|
|
#include "../dirview/dirview.h"
|
|
|
|
#include <<a href="tqsplitter-h.html">tqsplitter.h</a>>
|
|
#include <<a href="tqprogressbar-h.html">tqprogressbar.h</a>>
|
|
#include <<a href="tqlabel-h.html">tqlabel.h</a>>
|
|
#include <<a href="tqstatusbar-h.html">tqstatusbar.h</a>>
|
|
#include <<a href="tqtoolbar-h.html">tqtoolbar.h</a>>
|
|
#include <<a href="tqcombobox-h.html">tqcombobox.h</a>>
|
|
#include <<a href="tqpixmap-h.html">tqpixmap.h</a>>
|
|
#include <<a href="tqtoolbutton-h.html">tqtoolbutton.h</a>>
|
|
#include <<a href="tqdir-h.html">tqdir.h</a>>
|
|
#include <<a href="tqfileinfo-h.html">tqfileinfo.h</a>>
|
|
|
|
static const char* cdtoparent_xpm[]={
|
|
"15 13 3 1",
|
|
". c None",
|
|
"* c #000000",
|
|
"a c #ffff99",
|
|
"..*****........",
|
|
".*aaaaa*.......",
|
|
"***************",
|
|
"*aaaaaaaaaaaaa*",
|
|
"*aaaa*aaaaaaaa*",
|
|
"*aaa***aaaaaaa*",
|
|
"*aa*****aaaaaa*",
|
|
"*aaaa*aaaaaaaa*",
|
|
"*aaaa*aaaaaaaa*",
|
|
"*aaaa******aaa*",
|
|
"*aaaaaaaaaaaaa*",
|
|
"*aaaaaaaaaaaaa*",
|
|
"***************"};
|
|
|
|
static const char* newfolder_xpm[] = {
|
|
"15 14 4 1",
|
|
" c None",
|
|
". c #000000",
|
|
"+ c #FFFF00",
|
|
"@ c #FFFFFF",
|
|
" . ",
|
|
" ",
|
|
" . ",
|
|
" . . ",
|
|
" .... . . . ",
|
|
" .+@+@. . . ",
|
|
".......... . .",
|
|
".@+@+@+@+@.. ",
|
|
".+@+@+@+@+. . ",
|
|
".@+@+@+@+@. . ",
|
|
".+@+@+@+@+. ",
|
|
".@+@+@+@+@. ",
|
|
".+@+@+@+@+. ",
|
|
"........... "};
|
|
|
|
<a name="f324"></a>FileMainWindow::FileMainWindow()
|
|
: <a href="tqmainwindow.html">TQMainWindow</a>()
|
|
{
|
|
setup();
|
|
}
|
|
|
|
void FileMainWindow::<a href="tqwidget.html#show">show</a>()
|
|
{
|
|
TQMainWindow::<a href="tqwidget.html#show">show</a>();
|
|
}
|
|
|
|
void <a name="f325"></a>FileMainWindow::setup()
|
|
{
|
|
<a href="tqsplitter.html">TQSplitter</a> *splitter = new <a href="tqsplitter.html">TQSplitter</a>( this );
|
|
|
|
dirlist = new DirectoryView( splitter, "dirlist", TRUE );
|
|
<a name="x886"></a> dirlist-><a href="tqlistview.html#addColumn">addColumn</a>( "Name" );
|
|
dirlist-><a href="tqlistview.html#addColumn">addColumn</a>( "Type" );
|
|
Directory *root = new Directory( dirlist, "/" );
|
|
<a name="x887"></a> root-><a href="tqlistviewitem.html#setOpen">setOpen</a>( TRUE );
|
|
<a name="x894"></a> splitter-><a href="tqsplitter.html#setResizeMode">setResizeMode</a>( dirlist, TQSplitter::KeepSize );
|
|
|
|
fileview = new TQtFileIconView( "/", splitter );
|
|
<a name="x884"></a> fileview-><a href="tqiconview.html#setSelectionMode">setSelectionMode</a>( TQIconView::Extended );
|
|
|
|
<a href="tqmainwindow.html#setCentralWidget">setCentralWidget</a>( splitter );
|
|
|
|
<a href="tqtoolbar.html">TQToolBar</a> *toolbar = new <a href="tqtoolbar.html">TQToolBar</a>( this, "toolbar" );
|
|
<a href="tqmainwindow.html#setRightJustification">setRightJustification</a>( TRUE );
|
|
|
|
(void)new <a href="tqlabel.html">TQLabel</a>( <a href="tqobject.html#tr">tr</a>( " Path: " ), toolbar );
|
|
|
|
pathCombo = new <a href="tqcombobox.html">TQComboBox</a>( TRUE, toolbar );
|
|
<a name="x880"></a> pathCombo-><a href="tqcombobox.html#setAutoCompletion">setAutoCompletion</a>( TRUE );
|
|
<a name="x896"></a> toolbar-><a href="tqtoolbar.html#setStretchableWidget">setStretchableWidget</a>( pathCombo );
|
|
<a name="x877"></a> <a href="tqobject.html#connect">connect</a>( pathCombo, TQ_SIGNAL( <a href="tqcombobox.html#activated">activated</a>( const <a href="tqstring.html">TQString</a> & ) ),
|
|
this, TQ_SLOT ( changePath( const <a href="tqstring.html">TQString</a> & ) ) );
|
|
|
|
<a name="x895"></a> toolbar-><a href="tqtoolbar.html#addSeparator">addSeparator</a>();
|
|
|
|
<a href="tqpixmap.html">TQPixmap</a> pix;
|
|
|
|
pix = TQPixmap( cdtoparent_xpm );
|
|
upButton = new <a href="tqtoolbutton.html">TQToolButton</a>( pix, "One directory up", <a href="tqstring.html#TQString-null">TQString::null</a>,
|
|
this, TQ_SLOT( cdUp() ), toolbar, "cd up" );
|
|
|
|
pix = TQPixmap( newfolder_xpm );
|
|
mkdirButton = new <a href="tqtoolbutton.html">TQToolButton</a>( pix, "New Folder", TQString::null,
|
|
this, TQ_SLOT( newFolder() ), toolbar, "new folder" );
|
|
|
|
<a href="tqobject.html#connect">connect</a>( dirlist, TQ_SIGNAL( folderSelected( const <a href="tqstring.html">TQString</a> & ) ),
|
|
fileview, TQ_SLOT ( setDirectory( const <a href="tqstring.html">TQString</a> & ) ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( directoryChanged( const <a href="tqstring.html">TQString</a> & ) ),
|
|
this, TQ_SLOT( directoryChanged( const <a href="tqstring.html">TQString</a> & ) ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( startReadDir( int ) ),
|
|
this, TQ_SLOT( slotStartReadDir( int ) ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( readNextDir() ),
|
|
this, TQ_SLOT( slotReadNextDir() ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( readDirDone() ),
|
|
this, TQ_SLOT( slotReadDirDone() ) );
|
|
|
|
<a href="tqmainwindow.html#setDockEnabled">setDockEnabled</a>( DockLeft, FALSE );
|
|
<a href="tqmainwindow.html#setDockEnabled">setDockEnabled</a>( DockRight, FALSE );
|
|
|
|
label = new <a href="tqlabel.html">TQLabel</a>( <a href="tqmainwindow.html#statusBar">statusBar</a>() );
|
|
<a href="tqmainwindow.html#statusBar">statusBar</a>()->addWidget( label, 2, TRUE );
|
|
progress = new <a href="tqprogressbar.html">TQProgressBar</a>( <a href="tqmainwindow.html#statusBar">statusBar</a>() );
|
|
<a href="tqmainwindow.html#statusBar">statusBar</a>()->addWidget( progress, 1, TRUE );
|
|
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( enableUp() ),
|
|
this, TQ_SLOT( enableUp() ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( disableUp() ),
|
|
this, TQ_SLOT( disableUp() ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( enableMkdir() ),
|
|
this, TQ_SLOT( enableMkdir() ) );
|
|
<a href="tqobject.html#connect">connect</a>( fileview, TQ_SIGNAL( disableMkdir() ),
|
|
this, TQ_SLOT( disableMkdir() ) );
|
|
}
|
|
|
|
void <a name="f326"></a>FileMainWindow::setPathCombo()
|
|
{
|
|
<a href="tqstring.html">TQString</a> dir = <a href="tqwidget.html#caption">caption</a>();
|
|
int i = 0;
|
|
bool found = FALSE;
|
|
<a name="x878"></a> for ( i = 0; i < pathCombo-><a href="tqcombobox.html#count">count</a>(); ++i ) {
|
|
<a name="x882"></a> if ( pathCombo-><a href="tqcombobox.html#text">text</a>( i ) == dir) {
|
|
found = TRUE;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ( found )
|
|
<a name="x881"></a> pathCombo-><a href="tqcombobox.html#setCurrentItem">setCurrentItem</a>( i );
|
|
else {
|
|
<a name="x879"></a> pathCombo-><a href="tqcombobox.html#insertItem">insertItem</a>( dir );
|
|
pathCombo-><a href="tqcombobox.html#setCurrentItem">setCurrentItem</a>( pathCombo-><a href="tqcombobox.html#count">count</a>() - 1 );
|
|
}
|
|
|
|
}
|
|
|
|
void <a name="f327"></a>FileMainWindow::directoryChanged( const <a href="tqstring.html">TQString</a> &dir )
|
|
{
|
|
<a href="tqwidget.html#setCaption">setCaption</a>( dir );
|
|
setPathCombo();
|
|
}
|
|
|
|
void <a name="f328"></a>FileMainWindow::slotStartReadDir( int dirs )
|
|
{
|
|
label-><a href="tqlabel.html#setText">setText</a>( <a href="tqobject.html#tr">tr</a>( " Reading Directory..." ) );
|
|
<a name="x890"></a> progress-><a href="tqprogressbar.html#reset">reset</a>();
|
|
<a name="x892"></a> progress-><a href="tqprogressbar.html#setTotalSteps">setTotalSteps</a>( dirs );
|
|
}
|
|
|
|
void <a name="f329"></a>FileMainWindow::slotReadNextDir()
|
|
{
|
|
<a name="x889"></a> int p = progress-><a href="tqprogressbar.html#progress">progress</a>();
|
|
<a name="x891"></a> progress-><a href="tqprogressbar.html#setProgress">setProgress</a>( ++p );
|
|
}
|
|
|
|
void <a name="f330"></a>FileMainWindow::slotReadDirDone()
|
|
{
|
|
label-><a href="tqlabel.html#setText">setText</a>( <a href="tqobject.html#tr">tr</a>( " Reading Directory Done." ) );
|
|
<a name="x893"></a> progress-><a href="tqprogressbar.html#setProgress">setProgress</a>( progress-><a href="tqprogressbar.html#totalSteps">totalSteps</a>() );
|
|
}
|
|
|
|
void <a name="f331"></a>FileMainWindow::cdUp()
|
|
{
|
|
<a href="tqdir.html">TQDir</a> dir = fileview->currentDir();
|
|
<a name="x883"></a> dir.<a href="tqdir.html#cd">cd</a>( ".." );
|
|
fileview->setDirectory( dir );
|
|
}
|
|
|
|
void <a name="f332"></a>FileMainWindow::newFolder()
|
|
{
|
|
fileview->newDirectory();
|
|
}
|
|
|
|
void <a name="f333"></a>FileMainWindow::changePath( const <a href="tqstring.html">TQString</a> &path )
|
|
{
|
|
if ( TQFileInfo( path ).exists() )
|
|
fileview->setDirectory( path );
|
|
else
|
|
setPathCombo();
|
|
}
|
|
|
|
void <a name="f334"></a>FileMainWindow::enableUp()
|
|
{
|
|
<a name="x897"></a> upButton-><a href="tqwidget.html#setEnabled">setEnabled</a>( TRUE );
|
|
}
|
|
|
|
void <a name="f335"></a>FileMainWindow::disableUp()
|
|
{
|
|
upButton-><a href="tqwidget.html#setEnabled">setEnabled</a>( FALSE );
|
|
}
|
|
|
|
void <a name="f336"></a>FileMainWindow::enableMkdir()
|
|
{
|
|
mkdirButton-><a href="tqwidget.html#setEnabled">setEnabled</a>( TRUE );
|
|
}
|
|
|
|
void <a name="f337"></a>FileMainWindow::disableMkdir()
|
|
{
|
|
mkdirButton-><a href="tqwidget.html#setEnabled">setEnabled</a>( FALSE );
|
|
}
|
|
</pre>
|
|
|
|
<p> <hr>
|
|
<p> Main:
|
|
<p> <pre>/****************************************************************************
|
|
** $Id: qt/main.cpp 3.3.8 edited Jan 11 14:37 $
|
|
**
|
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|
**
|
|
** This file is part of an example program for TQt. This example
|
|
** program may be used, distributed and modified without limitation.
|
|
**
|
|
*****************************************************************************/
|
|
|
|
#include "mainwindow.h"
|
|
#include "tqfileiconview.h"
|
|
|
|
#include <<a href="tqapplication-h.html">tqapplication.h</a>>
|
|
|
|
|
|
int main( int argc, char **argv )
|
|
{
|
|
<a href="tqapplication.html">TQApplication</a> a( argc, argv );
|
|
|
|
FileMainWindow mw;
|
|
mw.<a href="tqwidget.html#resize">resize</a>( 680, 480 );
|
|
a.<a href="tqapplication.html#setMainWidget">setMainWidget</a>( &mw );
|
|
mw.fileView()->setDirectory( "/" );
|
|
<a name="x900"></a> mw.<a href="tqwidget.html#show">show</a>();
|
|
return a.<a href="tqapplication.html#exec">exec</a>();
|
|
}
|
|
</pre>
|
|
|
|
<p>See also <a href="examples.html">Examples</a>.
|
|
|
|
<!-- eof -->
|
|
<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|