Ejemplo n.º 1
0
void KUrlCompletionTest::setup( bool setDirAsURL )
{
    kDebug() ;
    m_completion = new KUrlCompletion;
    m_tempDir = new KTempDir;
    m_dir = m_tempDir->name();
    Q_ASSERT( m_dir.endsWith( "/" ) );
    m_dir += "Dir With#Spaces/";
    QDir().mkdir(m_dir);
    kDebug() << "m_dir=" << m_dir;
    if ( setDirAsURL ) {
        m_completion->setDir( KUrl(m_dir).url() );
    } else {
        m_completion->setDir( m_dir );
    }
    m_dirURL.setPath( m_dir );

    QFile f1( m_dir + "/file1" );
    bool ok = f1.open( QIODevice::WriteOnly );
    assert( ok );
    f1.close();

    QFile f2( m_dir + "/file#a" );
    ok = f2.open( QIODevice::WriteOnly );
    assert( ok );
    f2.close();

    QDir().mkdir( m_dir + "/file_subdir" );

    m_completionEmptyCwd = new KUrlCompletion;
    m_completionEmptyCwd->setDir( "" );
}
Ejemplo n.º 2
0
void KArchiveTest::testZipAddLocalDirectory()
{
    // Prepare local dir
    KTempDir tmpDir;
    const QString dirName = tmpDir.name();

    const QByteArray file1Data = "Hello Shantanu";
    const QString file1 = QLatin1String("file1");
    QVERIFY(writeFile(dirName, file1, file1Data));

    {
        KZip zip(s_zipFileName);

        QVERIFY(zip.open(QIODevice::WriteOnly));
        QVERIFY(zip.addLocalDirectory(dirName, "."));
        QVERIFY(zip.close());
    }
    {
        KZip zip(s_zipFileName);

        QVERIFY(zip.open(QIODevice::ReadOnly));

        const KArchiveDirectory* dir = zip.directory();
        QVERIFY(dir != 0);

        const KArchiveEntry* e = dir->entry(file1);
        QVERIFY(e && e->isFile());
        const KArchiveFile* f = (KArchiveFile*)e;
        QCOMPARE(f->data(), file1Data);
    }
}
Ejemplo n.º 3
0
KUrl KPrHtmlExport::exportPreview(const Parameter &parameters)
{
    m_parameters = parameters;

    // Create a temporary dir
    KTempDir tmpDir;
    tmpDir.setAutoRemove(false);
    m_tmpDirPath = tmpDir.name();
    extractStyle();
    exportImageToTmpDir();
    generateHtml();

    KUrl previewUrl;
    previewUrl.setPath(tmpDir.name());
    previewUrl.addPath("slide0.html");
    return previewUrl;
}
Ejemplo n.º 4
0
static void testCopyTo( KArchive* archive )
{
    const KArchiveDirectory* dir = archive->directory();
    KTempDir tmpDir;
    const QString dirName = tmpDir.name();

    dir->copyTo( dirName );

    QVERIFY(QFile::exists(dirName+"dir"));
    QVERIFY(QFileInfo(dirName+"dir").isDir());

    QFileInfo fileInfo1(dirName+"dir/subdir/mediumfile2");
    QVERIFY(fileInfo1.exists());
    QVERIFY(fileInfo1.isFile());
    QCOMPARE(fileInfo1.size(), Q_INT64_C(100));

    QFileInfo fileInfo2(dirName+"hugefile");
    QVERIFY(fileInfo2.exists());
    QVERIFY(fileInfo2.isFile());
    QCOMPARE(fileInfo2.size(), Q_INT64_C(20000));

    QFileInfo fileInfo3(dirName+"mediumfile");
    QVERIFY(fileInfo3.exists());
    QVERIFY(fileInfo3.isFile());
    QCOMPARE(fileInfo3.size(), Q_INT64_C(100));

    QFileInfo fileInfo4(dirName+"my/dir/test3");
    QVERIFY(fileInfo4.exists());
    QVERIFY(fileInfo4.isFile());
    QCOMPARE(fileInfo4.size(), Q_INT64_C(29));

#ifndef Q_OS_WIN
    const QString fileName = dirName+"z/test3_symlink";
    const QFileInfo fileInfo5(fileName);
    QVERIFY(fileInfo5.exists());
    QVERIFY(fileInfo5.isFile());
    // Do not use fileInfo.readLink() for unix symlinks
    // It returns the -full- path to the target, while we want the target string "as is".
    QString symLinkTarget;
    const QByteArray encodedFileName = QFile::encodeName(fileName);
    QByteArray s;
#if defined(PATH_MAX)
    s.resize(PATH_MAX+1);
#else
    int path_max = pathconf(encodedFileName.data(), _PC_PATH_MAX);
    if (path_max <= 0) {
        path_max = 4096;
    }
    s.resize(path_max);
#endif
    int len = readlink(encodedFileName.data(), s.data(), s.size() - 1);
    if ( len >= 0 ) {
        s[len] = '\0';
        symLinkTarget = QFile::decodeName(s);
    }
    QCOMPARE(symLinkTarget, QString("test3"));
#endif
}
Ejemplo n.º 5
0
void KTempDirTest::testAutoDelete()
{
	KTempDir *dir = new KTempDir("test");
	QVERIFY(dir->status() == 0);
	QVERIFY(dir->exists());

	QString dName = dir->name();
	delete dir;
	QVERIFY(!QDir(dName).exists());
}
Ejemplo n.º 6
0
void KTempDirTest::testCreateSubDir()
{
	KTempDir *dir = new KTempDir("test");
	QVERIFY(dir->status() == 0);
	QVERIFY(dir->exists());

	QDir d ( dir->name() );
	QVERIFY(d.exists());

	QVERIFY(d.mkdir(QString("123")));
	QVERIFY(d.mkdir(QString("456")));

	QString dName = dir->name();
	delete dir;
	d.refresh();

	QVERIFY(!QDir(dName).exists());
	QVERIFY(!d.exists(QString("123")));
	QVERIFY(!d.exists(QString("456")));
}
void SvnRecursiveAdd::test()
{
    KTempDir reposDir;
    KProcess cmd;
    cmd.setWorkingDirectory(reposDir.name());
    cmd << "svnadmin" << "create" << reposDir.name();
    QCOMPARE(cmd.execute(10000), 0);
    AutoTestShell::init();
    std::auto_ptr<TestCore> core(new TestCore());
    core->initialize(Core::Default);
    QList<IPlugin*> plugins = Core::self()->pluginController()->allPluginsForExtension("org.kdevelop.IBasicVersionControl");
    IBasicVersionControl* vcs = NULL;
    foreach(IPlugin* p,  plugins) {
        qDebug() << "checking plugin" << p;    
        ICentralizedVersionControl* icentr = p->extension<ICentralizedVersionControl>();
        if (!icentr)
            continue;
        if (icentr->name() == "Subversion") {
            vcs = icentr;
            break;
        }
    }
Ejemplo n.º 8
0
void KPrHtmlExport::exportHtml(const KPrHtmlExport::Parameter &parameters)
{
    m_parameters = parameters;

    // Create a temporary dir
    KTempDir tmpDir;
    m_tmpDirPath = tmpDir.name();
    tmpDir.setAutoRemove(false);
    extractStyle();
    exportImageToTmpDir();
    generateHtml();
    generateToc();
    copyFromTmpToDest();
}
Ejemplo n.º 9
0
void ViewManager::startDrag()
{
    // Get the list of all the selected addressees
    KABC::Addressee::List addrList;
    const QStringList uidList = selectedUids();
    if(uidList.isEmpty())
        return;

    kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;

    QStringList::ConstIterator it;
    for(it = uidList.begin(); it != uidList.end(); ++it)
        addrList.append(mCore->addressBook()->findByUid(*it));

    KMultipleDrag *drag = new KMultipleDrag(this);

    KABC::VCardConverter converter;
    QString vcards = converter.createVCards(addrList);

    // Best text representation is given by textdrag, so it must be first
    drag->addDragObject(new QTextDrag(AddresseeUtil::addresseesToEmails(addrList), this));
    drag->addDragObject(new KVCardDrag(vcards, this));

    KTempDir tempDir;
    // can't set tempDir to autoDelete, in case of dropping on the desktop, the copy is async...
    if(tempDir.status() == 0)
    {
        QString fileName;
        if(addrList.count() == 1)
            fileName = addrList[ 0 ].givenName() + "_" + addrList[ 0 ].familyName() + ".vcf";
        else
            fileName = "contacts.vcf";

        QFile tempFile(tempDir.name() + "/" + fileName);
        if(tempFile.open(IO_WriteOnly))
        {
            tempFile.writeBlock(vcards.utf8());
            tempFile.close();

            KURLDrag *urlDrag = new KURLDrag(KURL(tempFile.name()), this);
            drag->addDragObject(urlDrag);
        }
    }

    drag->setPixmap(KGlobal::iconLoader()->loadIcon("vcard", KIcon::Desktop));
    drag->dragCopy();
}
void TemplateSelectionPagePrivate::previewTemplate(const QString& file)
{
    SourceFileTemplate fileTemplate(file);
    if (!fileTemplate.isValid() || fileTemplate.outputFiles().isEmpty()) {
        return;
    }

    KTempDir dir;
    KUrl base(dir.name());
    QHash<QString, KUrl> fileUrls;
    foreach(const SourceFileTemplate::OutputFile& out, fileTemplate.outputFiles()) {
        KUrl url(base);
        url.addPath(out.outputName);
        fileUrls.insert(out.identifier, url);
    }
    TemplatePreviewRenderer renderer;
    renderer.setEmptyLinesPolicy(TemplateRenderer::TrimEmptyLines);
    DocumentChangeSet changes = renderer.renderFileTemplate(fileTemplate, base, fileUrls);
    changes.setActivationPolicy(DocumentChangeSet::DoNotActivate);
    changes.setUpdateHandling(DocumentChangeSet::NoUpdate);
    DocumentChangeSet::ChangeResult result = changes.applyAllChanges();
    if (!result) {
        return;
    }

    int idx = 0;
    foreach(const SourceFileTemplate::OutputFile& out, fileTemplate.outputFiles()) {
        TemplatePreview* preview = 0;
        if (ui->tabWidget->count() > idx) {
            // reuse existing tab
            preview = qobject_cast<TemplatePreview*>(ui->tabWidget->widget(idx));
            ui->tabWidget->setTabText(idx, out.label);
            Q_ASSERT(preview);
        } else {
            // create new tabs on demand
            preview = new TemplatePreview(page);
            ui->tabWidget->addTab(preview, out.label);
        }
        preview->document()->openUrl(fileUrls.value(out.identifier));
        ++idx;
    }
    // remove superflous tabs from last time
    while (ui->tabWidget->count() > fileUrls.size()) {
        delete ui->tabWidget->widget(fileUrls.size());
    }
    return;
}
Ejemplo n.º 11
0
bool BasketThumbCreator::create(const QString &path, int /*width*/, int /*height*/, QImage &image)
{
	// Create the temporar folder:
	KTempDir tempDir;
	tempDir.setAutoRemove(true);
	QString tempFolder = tempDir.name();
	QDir dir;
	dir.mkdir(tempFolder);
	const unsigned long int BUFFER_SIZE = 1024;

	QFile file(path);
	if (file.open(QIODevice::ReadOnly)) {
		QTextStream stream(&file);
		stream.setCodec(QTextCodec::codecForName("UTF-8"));
		QString line = stream.readLine();
		if (line != "BasKetNP:archive" && line != "BasKetNP:template") {
			file.close();
			return false;
		}
		while (!stream.atEnd()) {
			// Get Key/Value Pair From the Line to Read:
			line = stream.readLine();
			int index = line.indexOf(':');
			QString key;
			QString value;
			if (index >= 0) {
				key = line.left(index);
				value = line.right(line.length() - index - 1);
			} else {
				key = line;
				value = "";
			}
			if (key == "preview*") {
				bool ok;
				ulong size = value.toULong(&ok);
				if (!ok) {
					file.close();
					return false;
				}
				// Get the preview file:
				QFile previewFile(tempFolder + "preview.png");
				if (previewFile.open(QIODevice::WriteOnly)) {
					char *buffer = new char[BUFFER_SIZE];
					long int sizeRead;
					while ((sizeRead = file.read(buffer, qMin(BUFFER_SIZE, size))) > 0) {
						previewFile.write(buffer, sizeRead);
						size -= sizeRead;
					}
					previewFile.close();
					delete buffer;
					image = QImage(tempFolder + "preview.png");
					file.close();
					return true;
				}
			} else if (key.endsWith("*")) {
				// We do not know what it is, but we should read the embedded-file in order to discard it:
				bool ok;
				ulong size = value.toULong(&ok);
				if (!ok) {
					file.close();
					return false;
				}
				// Get the archive file:
				char *buffer = new char[BUFFER_SIZE];
				long int sizeRead;
				while ((sizeRead = file.read(buffer, qMin(BUFFER_SIZE, size))) > 0) {
					size -= sizeRead;
				}
				delete buffer;
			}
		}
		file.close();
	}
	return false;
}
Ejemplo n.º 12
0
void QuickOpenTest::testProjectFileFilter()
{
    KTempDir dir;
    TestProject* project = new TestProject(KUrl(dir.name()));
    ProjectFolderItem* foo = createChild<ProjectFolderItem>(project->projectItem(), "foo");
    createChild<ProjectFileItem>(foo, "bar");
    createChild<ProjectFileItem>(foo, "asdf");
    ProjectFolderItem* asdf = createChild<ProjectFolderItem>(project->projectItem(), "asdf");
    createChild<ProjectFileItem>(asdf, "bar");

    QTemporaryFile tmpFile;
    tmpFile.setFileName(dir.name() + "aaaa");
    QVERIFY(tmpFile.open());
    ProjectFileItem* aaaa = new ProjectFileItem(project, KUrl(tmpFile.fileName()), project->projectItem());
    QCOMPARE(project->fileSet().size(), 4);

    ProjectFileDataProvider provider;
    QCOMPARE(provider.itemCount(), 0u);
    projectController->addProject(project);

    const QStringList original = QStringList() << "aaaa" << "asdf/bar" << "foo/asdf" << "foo/bar";

    // lazy load
    QCOMPARE(provider.itemCount(), 0u);
    provider.reset();
    QCOMPARE(items(provider), original);

    QCOMPARE(provider.itemText(provider.items().first()), aaaa->url().pathOrUrl());
    QCOMPARE(provider.data(0)->text(), QString("aaaa"));

    // don't show opened file
    QVERIFY(core->documentController()->openDocument(KUrl(tmpFile.fileName())));
    // lazy load again
    QCOMPARE(items(provider), original);
    provider.reset();
    QCOMPARE(items(provider), QStringList() << "asdf/bar" << "foo/asdf" << "foo/bar");

    // prefer files starting with filter
    provider.setFilterText("as");
    qDebug() << items(provider);
    QCOMPARE(items(provider), QStringList() << "foo/asdf" << "asdf/bar");

    // clear filter
    provider.reset();
    QCOMPARE(items(provider), QStringList() << "asdf/bar" << "foo/asdf" << "foo/bar");

    // update on document close, lazy load again
    core->documentController()->closeAllDocuments();
    QCOMPARE(items(provider), QStringList() << "asdf/bar" << "foo/asdf" << "foo/bar");
    provider.reset();
    QCOMPARE(items(provider), original);

    ProjectFileItem* blub = createChild<ProjectFileItem>(project->projectItem(), "blub");
    // lazy load
    QCOMPARE(provider.itemCount(), 4u);
    provider.reset();
    QCOMPARE(provider.itemCount(), 5u);

    // ensure we don't add stuff multiple times
    QMetaObject::invokeMethod(&provider, "fileAddedToSet",
                              Q_ARG(KDevelop::IProject*, project),
                              Q_ARG(KDevelop::IndexedString, blub->indexedUrl()));
    QCOMPARE(provider.itemCount(), 5u);
    provider.reset();
    QCOMPARE(provider.itemCount(), 5u);

    // lazy load in this implementation
    delete blub;
    QCOMPARE(provider.itemCount(), 5u);
    provider.reset();
    QCOMPARE(provider.itemCount(), 4u);

    QCOMPARE(items(provider), original);

    projectController->closeProject(project);
    provider.reset();
    QVERIFY(!provider.itemCount());
}
Ejemplo n.º 13
0
bool CFontThumbnail::create(const QString &path, int width, int height, QImage &img)
{
    QString  realPath(path);
    KTempDir *tempDir = 0;

    KFI_DBUG << "Create font thumbnail for:" << path << endl;

    // Is this a appliaction/vnd.kde.fontspackage file? If so, extract 1 scalable font...
    if(Misc::isPackage(path) || "application/zip"==KMimeType::findByFileContent(path)->name())
    {
        KZip zip(path);

        if(zip.open(QIODevice::ReadOnly))
        {
            const KArchiveDirectory *zipDir=zip.directory();

            if(zipDir)
            {
                QStringList fonts(zipDir->entries());

                if(fonts.count())
                {
                    QStringList::ConstIterator it(fonts.begin()),
                                               end(fonts.end());

                    for(; it!=end; ++it)
                    {
                        const KArchiveEntry *entry=zipDir->entry(*it);

                        if(entry && entry->isFile())
                        {
                            delete tempDir;
                            tempDir=new KTempDir(KStandardDirs::locateLocal("tmp", KFI_TMP_DIR_PREFIX));
                            tempDir->setAutoRemove(true);

                            ((KArchiveFile *)entry)->copyTo(tempDir->name());

                            QString mime(KMimeType::findByPath(tempDir->name()+entry->name())->name());

                            if(mime=="application/x-font-ttf" || mime=="application/x-font-otf" ||
                               mime=="application/x-font-type1")
                            {
                                realPath=tempDir->name()+entry->name();
                                break;
                            }
                            else
                                ::unlink(QFile::encodeName(tempDir->name()+entry->name()).data());
                        }
                    }
                }
            }
        }
    }

    QColor bgnd(Qt::black);

    bgnd.setAlpha(0);
    img=itsEngine.draw(realPath, KFI_NO_STYLE_INFO, 0, QApplication::palette().text().color(), bgnd, width, height, true);

    delete tempDir;
    return !img.isNull();
}
    foreach(IPlugin* p,  plugins) {
        qDebug() << "checking plugin" << p;    
        ICentralizedVersionControl* icentr = p->extension<ICentralizedVersionControl>();
        if (!icentr)
            continue;
        if (icentr->name() == "Subversion") {
            vcs = icentr;
            break;
        }
    }
    qDebug() << "ok, got vcs" << vcs;
    QVERIFY(vcs);
    VcsLocation reposLoc;
    reposLoc.setRepositoryServer("file://" + reposDir.name());
    KTempDir checkoutDir;
    KUrl checkoutLoc = checkoutDir.name();
    kDebug() << "Checking out from " << reposLoc.repositoryServer() << " to " << checkoutLoc;
    qDebug() << "creating job";
    VcsJob* job = vcs->createWorkingCopy( reposLoc, checkoutLoc );
    validatingExecJob(job);
    qDebug() << "filling wc";
    fillWorkingDirectory(checkoutDir.name());
    KUrl addUrl = checkoutLoc;
    addUrl.addPath( vcsTestDir0 );
    kDebug() << "Recursively adding files at " << addUrl;
    validatingExecJob(vcs->add(KUrl(addUrl), IBasicVersionControl::Recursive));
    kDebug() << "Recursively reverting changes at " << addUrl;
    validatingExecJob(vcs->revert(KUrl(addUrl), IBasicVersionControl::Recursive));
}

QTEST_KDEMAIN(SvnRecursiveAdd, GUI)
Ejemplo n.º 15
0
void subversionCore::diff( const KURL::List& list, const QString& where){
	kdDebug(9036) << "diff " << list << endl;
	KURL servURL = "kdevsvn+svn://this_is_a_fake_URL_and_this_is_normal/";
	for ( QValueListConstIterator<KURL> it = list.begin(); it != list.end() ; ++it ) {
		QByteArray parms;
		QDataStream s( parms, IO_WriteOnly );
		int cmd = 13;
		kdDebug(9036) << "diffing : " << (*it).prettyURL() << endl;
		int rev1=-1;
		int rev2=-1;
		QString revkind1 = where;
		QString revkind2 = "WORKING";
		s << cmd << *it << *it << rev1 << revkind1 << rev2 << revkind2 << true ;
		KIO::SimpleJob * job = KIO::special(servURL, parms, true);
		connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) );
		KIO::NetAccess::synchronousRun( job, 0 );
		if ( diffresult.count() > 0 ) {
			//check kompare is available
			if ( !KStandardDirs::findExe( "kompare" ).isNull() ) {
				if (!KStandardDirs::findExe("patch").isNull()){
					// we have patch - so can merge
					KTempDir tmpDir = KTempDir(diffTmpDir->name());
					KTempFile tmpPatch = KTempFile(tmpDir.name());

					// write the patch
					QTextStream *stream = tmpPatch.textStream();
					stream->setCodec( QTextCodec::codecForName( "utf8" ) );
					for ( QStringList::Iterator it2 = diffresult.begin();it2 != diffresult.end() ; ++it2 ) {
						( *stream ) << ( *it2 ) << "\n";
					}
					tmpPatch.close();

					QString ourCopy = tmpDir.name()+(*it).fileName();

					KProcess copy;
					copy << "cp" << (*it).prettyURL(0,KURL::StripFileProtocol) <<  tmpDir.name();
					copy.start(KProcess::Block);

					KProcess patch;
					patch.setWorkingDirectory(tmpDir.name());
					patch << "patch" << "-R" << ourCopy << tmpPatch.name();
					patch.start(KProcess::Block, KProcess::All);

					KProcess *p = new KProcess;
					*p << "kompare" << ourCopy << (*it).prettyURL();
					p->start();
				}
				else{
					// only diff
					KTempFile *tmp = new KTempFile;
					tmp->setAutoDelete(true);
					QTextStream *stream = tmp->textStream();
					stream->setCodec( QTextCodec::codecForName( "utf8" ) );
					for ( QStringList::Iterator it2 = diffresult.begin();it2 != diffresult.end() ; ++it2 ) {
						( *stream ) << ( *it2 ) << "\n";
					}
					tmp->close();
					KProcess *p = new KProcess;
					*p << "kompare" << "-n" << "-o" << tmp->name();
					p->start();
				}
			} else { //else do it with message box
				Subversion_Diff df;
				for ( QStringList::Iterator it2 = diffresult.begin();it2 != diffresult.end() ; ++it2 ) {
					df.text->append( *it2 );
				}
				QFont f = df.font();
				f.setFixedPitch( true );
				df.text->setFont( f );
				df.exec();
			}
		}
		else{
			QString diffTo = i18n("the local disk checked out copy.");
			if ( where=="HEAD"){
				diffTo=i18n("the current svn HEAD version.");
			}
			KMessageBox::information( 0, i18n("No differences between the file and %1").arg(diffTo), i18n("No difference") );
		}
		diffresult.clear();
	}
}
Ejemplo n.º 16
0
Archivo: package.cpp Proyecto: KDE/silk
Package::Package(QString path, QObject* parent)
    : QObject(parent),
    m_metadata(new MetaData)
{
    /*
    A package roughly looks like this:

    examplepackage/
    |-- actions
    |   |-- silk-webapp-silk-commitlog.desktop
    |   |-- silk-webapp-silk-sidebar.desktop
    |   |-- silk-webapp-silk-sourcetree.desktop
    |   `-- silk-webapp-silk-urltrigger.desktop
    |-- plugin.desktop
    |-- scripts
    |   `-- togglesidebar.js
    `-- webapp.desktop


    */
    //m_metadata->pluginName = QString("silk");
    QString installedPath = findPackage(path);
    if (!installedPath.isEmpty()) {
        m_root = installedPath;
        m_metadataFile = m_root.path() + "/" + "metadata.desktop";
        readMetadata();
        readDir();
        //kDebug() << "installed, but valid?" << isValid();
        return;
    }

    QDir _d(path);
    if (_d.isRelative()) {
        path = QDir::currentPath() + "/" + path;
    }
    
    KUrl _dir(path);

    if (path.isEmpty()) {
        kDebug() << "Empty package structure";
    } else if (path.endsWith(".selkie")) {
        //kDebug() << "Package file:" << path;
        //QString unpackPath = "/tmp/unpacked/";

        KTempDir tmp;
        tmp.setAutoRemove(false);
        //kDebug() << "TempDir:" << tmp.name();
        QString unpackPath = tmp.name();
        importPackage(path, unpackPath);
        m_root = KUrl(unpackPath);
        m_metadataFile = unpackPath + "/" + "metadata.desktop";
        readMetadata();
        readDir();
    } else if (_dir.isValid()) {
        //kDebug() << "Reading dir" << _dir;
        m_root = _dir;
        m_metadataFile = m_root.path() + "/" + "metadata.desktop";
        readMetadata();
        readDir();
    }
    //show();
}