void User_File::Load_Connector()
{
startnow
= QDir::currentPath();
dirsizebite = 0;
dirandfile.clear();
qtcpeed = true;
setAcceptDrops(true);
modellocal->setResolveSymlinks(false);
modeluser->setResolveSymlinks(false);
usertree->setModel(modeluser);
mlocal->setModel(modellocal);
modeluser->setSupportedDragActions(Qt::CopyAction);
modellocal->setSupportedDragActions(Qt::CopyAction);
usertree->setDragEnabled(true);
mlocal->setDragEnabled(true);
mlocal->setRootIndex(modellocal->index(lstart));
usertree->setRootIndex(modeluser->index(ustart));
connect(usertree,
SIGNAL(clicked
(const QModelIndex &)),
this,
SLOT(GlobalContextU
(const QModelIndex
&)));
connect(mlocal,
SIGNAL(clicked
(const QModelIndex &)),
this,
SLOT(OpenLocalFile
(const QModelIndex
&)));
connect(pushButton, SIGNAL(clicked()),this, SLOT(ResetDBDir()));
usertree->resizeColumnToContents (0);
mlocal->resizeColumnToContents (0);
IndexDir(ustart);
qDebug() << "### dirsizebite " << dirsizebite;
dirowerflow = false;
if (dirsizebite > MAXDIRSIZE) {
dirowerflow = true;
QMessageBox::warning(this, tr
("User dir."),tr
("The maxiumum capacity of user dir is %1!").
arg(BiteorMega
(MAXDIRSIZE
)));
}
label_2->setText(tr("User Dir size %1 - %2 ")
.arg(BiteorMega(dirsizebite))
.arg(UmanTimeFromUnix(QTime_Null())));
dirandfile.clear();
Q_ASSERT(qtcpeed);
qtcpeed = false;
}
void User_File
::GlobalContextU( const QModelIndex &index
) {
if (!index.isValid()) {
return;
}
ResetDD();
userselect = true;
acc = true;
const QString filepath
= modeluser
->filePath
(index
);
/* model to fast! */
QTimer::singleShot(200,
this,
SLOT(User_Context
()));
}
void User_File::User_Context()
{
TContext
= new QMenu(this);
QString wat
= fi.
absoluteFilePath();
dir = checkdir.exists();
if (dir) {
TContext->addAction(tr( "Delete dir \"%1\" " ).arg(fi.fileName()), this , SLOT( DDrm() ) );
TContext->addAction(tr( "Open dir \"%1\" " ).arg(fi.fileName()), this , SLOT( DDop() ) );
} else {
TContext->addAction(tr( "Delete file \"%1\" " ).arg(fi.fileName()), this , SLOT( DDrm() ) );
TContext->addAction(tr( "Open file \"%1\" " ).arg(fi.fileName()), this , SLOT( DDop() ) );
}
TContext->addAction(tr( "New Dir here" ), this , SLOT( DDmkdir() ) );
TContext->addAction(tr( "Reload ..." ), this , SLOT( Load_Connector() ) );
TContext->addAction(tr( "User dir Close contex" ), TContext , SLOT( close() ) );
TContext->exec(last);
}
void User_File::Load_Connector()
{
startnow = QDir::currentPath();
dirsizebite = 0;
dirandfile.clear();
qtcpeed = true;
modeluser = new QDirModel;
modellocal = new QDirModel;
setAcceptDrops(true);
modellocal->setResolveSymlinks(false);
modeluser->setResolveSymlinks(false);
usertree->setModel(modeluser);
mlocal->setModel(modellocal);
modeluser->setSupportedDragActions(Qt::CopyAction);
modellocal->setSupportedDragActions(Qt::CopyAction);
usertree->setDragEnabled(true);
mlocal->setDragEnabled(true);
mlocal->setRootIndex(modellocal->index(lstart));
usertree->setRootIndex(modeluser->index(ustart));
connect(usertree, SIGNAL(clicked(const QModelIndex &)),this, SLOT(GlobalContextU(const QModelIndex&)));
connect(mlocal, SIGNAL(clicked(const QModelIndex &)),this, SLOT(OpenLocalFile(const QModelIndex&)));
connect(pushButton, SIGNAL(clicked()),this, SLOT(ResetDBDir()));
usertree->resizeColumnToContents (0);
mlocal->resizeColumnToContents (0);
IndexDir(ustart);
qDebug() << "### dirsizebite " << dirsizebite;
dirowerflow = false;
if (dirsizebite > MAXDIRSIZE) {
dirowerflow = true;
QMessageBox::warning(this, tr("User dir."),tr("The maxiumum capacity of user dir is %1!").arg(BiteorMega(MAXDIRSIZE)));
}
label_2->setText(tr("User Dir size %1 - %2 ")
.arg(BiteorMega(dirsizebite))
.arg(UmanTimeFromUnix(QTime_Null())));
dirandfile.clear();
Q_ASSERT(qtcpeed);
qtcpeed = false;
}
void User_File::GlobalContextU( const QModelIndex &index )
{
if (!index.isValid()) {
return;
}
ResetDD();
userselect = true;
acc = true;
const QString filepath = modeluser->filePath(index);
fi = QFileInfo(filepath);
last = QCursor::pos();
/* model to fast! */
QTimer::singleShot(200, this, SLOT(User_Context()));
}
void User_File::User_Context()
{
TContext = new QMenu(this);
QString wat = fi.absoluteFilePath();
QDir checkdir(wat);
dir = checkdir.exists();
if (dir) {
TContext->addAction(tr( "Delete dir \"%1\" " ).arg(fi.fileName()), this , SLOT( DDrm() ) );
TContext->addAction(tr( "Open dir \"%1\" " ).arg(fi.fileName()), this , SLOT( DDop() ) );
} else {
TContext->addAction(tr( "Delete file \"%1\" " ).arg(fi.fileName()), this , SLOT( DDrm() ) );
TContext->addAction(tr( "Open file \"%1\" " ).arg(fi.fileName()), this , SLOT( DDop() ) );
}
TContext->addAction(tr( "New Dir here" ), this , SLOT( DDmkdir() ) );
TContext->addAction(tr( "Reload ..." ), this , SLOT( Load_Connector() ) );
TContext->addAction(tr( "User dir Close contex" ), TContext , SLOT( close() ) );
TContext->exec(last);
}
To copy to clipboard, switch view to plain text mode
Bookmarks