Exemplo n.º 1
0
/**
  * constructor definition
  */
RelaxEngine::RelaxEngine(QObject *parent) :
    QObject(parent)
{
    connect(watcher, SIGNAL(directoryChanged(QString)), SLOT(refreshFolders(QString)),
            Qt::DirectConnection);

    //connect(this, SIGNAL(copyFinished()), SLOT(recallRefresh()));

}
Exemplo n.º 2
0
void FoldersWindow::getProfileDataByIndex(int index) {
    if(profilesCombo->count()==0) return;
    QString name = profilesCombo->itemText(index);
    xmlManager->setProfile(name);
    paths = xmlManager->getProfileDirPath();
    thumbs = xmlManager->getProfileDirThumb();
    renames = xmlManager->getProfileDirRename();
    digits = xmlManager->getProfileDirDigits();
    refreshFolders();
}
Exemplo n.º 3
0
void SelectiveSyncTreeView::setFolderInfo(const QString& folderPath, const QString& rootName, const QStringList& oldBlackList)
{
    _folderPath = folderPath;
    if (_folderPath.startsWith(QLatin1Char('/'))) {
        // remove leading '/'
        _folderPath = folderPath.mid(1);
    }
    _rootName = rootName;
    _oldBlackList = oldBlackList;
    refreshFolders();
}
Exemplo n.º 4
0
void DocumentCatalog::queryChanged()
{
	int newStatus = 0;
	if(query() == "")
	{
		// reset query
		dir = QDir::home();
		currentPath = "";
		queryMatched = 0;
		refreshFolders();
	} else {
		if(query().length() >= minQueryLen())
		{
			QString path = query().lower().remove(0, queryMatched);
			
			int index;
			while((index = path.find('/')) != -1) {
				QString folderQuery = path.left(index);
				QString guess = QString::null;
				
				for(QStringList::Iterator it = folders.begin(); it != folders.end(); ++it) {
					QString folderName = *it;
					if(folderName.lower().startsWith(folderQuery) && (guess.isNull() || folderName.length() < guess.length()))
						guess = folderName;
				}
				
				if(guess == QString::null) {
					path = QString::null;
					break;
				}
				
				if(!dir.cd(guess)) {
					path = QString::null;
					break;
				}
				refreshFolders();
				
				queryMatched += folderQuery.length() + 1;
				currentPath += guess + "/";
				path = path.remove(0, index+1);
			}
			
			Match newBestMatch;
			
			if(path.isNull()) {
				files.clear();
			} else {
				if(!filesListed) {
					refreshFiles();
				}
				if(!path.isEmpty()) {
					if(currentDirDoc != 0) {
						files.removeRef(currentDirDoc);
						currentDirDoc = 0;
					}
					QPtrListIterator<Document> it(files);
					Document *document;
					while((document = it.current()) != 0) {
						++it;
						if(document->name().lower().startsWith(path)) {
							int rank = 100*query().length()/document->text().length();
							if(newBestMatch.isNull() || rank > newBestMatch.rank())
								newBestMatch = Match(document, rank, currentPath.length() + path.length());
						} else {
							files.removeRef(document);
						}
					}
				}
			}
			
			if(currentDirDoc != 0 && path.isEmpty())
				newBestMatch = Match(currentDirDoc, 100, currentPath.length());

			newStatus |= S_Active;
			if(files.count() > 0)
			{
				newStatus |= S_HasResults;
				if(files.count() > 1 || files.at(0)->className() == "Directory")
					newStatus |= S_Multiple;
			} else
				newStatus |= S_NoResults;
				
 			setBestMatch(newBestMatch);
		} else {
			setBestMatch(Match());
		}
	}
	setStatus(newStatus);
}
Exemplo n.º 5
0
void DocumentCatalog::initialize()
{
	dir = QDir::home();
	refreshFolders();
	refreshFiles();
}