本文整理汇总了C++中Folder::path方法的典型用法代码示例。如果您正苦于以下问题:C++ Folder::path方法的具体用法?C++ Folder::path怎么用?C++ Folder::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startWizard
void OwncloudSetupWizard::startWizard()
{
FolderMan *folderMan = FolderMan::instance();
bool multiFolderSetup = folderMan->map().count() > 1;
// ###
Account *account = Account::restore();
if (!account) {
_ocWizard->setConfigExists(false);
account = new Account;
account->setCredentials(CredentialsFactory::create("dummy"));
} else {
_ocWizard->setConfigExists(true);
}
account->setSslErrorHandler(new SslDialogErrorHandler);
_ocWizard->setAccount(account);
_ocWizard->setOCUrl(account->url().toString());
_remoteFolder = Theme::instance()->defaultServerFolder();
// remoteFolder may be empty, which means /
QString localFolder = Theme::instance()->defaultClientFolder();
// if its a relative path, prepend with users home dir, otherwise use as absolute path
if( !QDir(localFolder).isAbsolute() ) {
localFolder = QDir::homePath() + QDir::separator() + localFolder;
}
if (!multiFolderSetup) {
QList<Folder*> folders = folderMan->map().values();
if (!folders.isEmpty()) {
Folder* folder = folders.first();
localFolder = QDir(folder->path()).absolutePath();
}
}
_ocWizard->setProperty("localFolder", localFolder);
// remember the local folder to compare later if it changed, but clean first
QString lf = QDir::fromNativeSeparators(localFolder);
if( !lf.endsWith(QLatin1Char('/'))) {
lf.append(QLatin1Char('/'));
}
_initLocalFolder = lf;
_ocWizard->setRemoteFolder(_remoteFolder);
_ocWizard->setStartId(WizardCommon::Page_ServerSetup);
_ocWizard->restart();
// settings re-initialized in initPage must be set here after restart
_ocWizard->setMultipleFoldersExist( multiFolderSetup );
_ocWizard->open();
_ocWizard->raise();
}
示例2: populate
void populate(Folder &folder)
{
// Get a list of the files in this directory.
Archive::Names names;
archive().listFiles(names, basePath);
DENG2_FOR_EACH(Archive::Names, i, names)
{
if(folder.has(*i))
{
// Already has an entry for this, skip it (wasn't pruned so it's OK).
continue;
}
String entry = basePath / *i;
std::auto_ptr<ArchiveEntryFile> archFile(new ArchiveEntryFile(*i, archive(), entry));
// Write access is inherited from the main source file.
if(allowWrite) archFile->setMode(File::Write);
// Use the status of the entry within the archive.
archFile->setStatus(archive().entryStatus(entry));
// Create a new file that accesses this feed's archive and interpret the contents.
File *f = folder.fileSystem().interpret(archFile.release());
folder.add(f);
// We will decide on pruning this.
f->setOriginFeed(&self);
// Include the file in the main index.
folder.fileSystem().index(*f);
}
// Also populate subfolders.
archive().listFolders(names, basePath);
for(Archive::Names::iterator i = names.begin(); i != names.end(); ++i)
{
folder.fileSystem().makeFolder(folder.path() / *i, FS::InheritPrimaryFeed);
}
}
示例3: logMessage
void MessageHandler::logMessage(SyncOutMessage * msg)
{
Folder * folder;
QString rel_path;
QStringList msg_labels;
for (int i = 0; i < msg->folderCount(); ++i) {
folder = folders->byId(msg->folderIdAt(i));
if (!folder)
continue;
msg_labels << folder->label();
if (!i)
rel_path = msg->stringAt(i).mid(folder->path().size());
//msg->labelFolder(i, folder->path().size(), folder->label());
}
addLogItem(msg, rel_path, msg_labels);
delete msg;
}
示例4: isComplete
bool FolderWizardSourcePage::isComplete() const
{
QFileInfo selFile( QDir::fromNativeSeparators(_ui.localFolderLineEdit->text()) );
QString userInput = selFile.canonicalFilePath();
QString warnString;
bool isOk = selFile.isDir();
if( !isOk ) {
warnString = tr("No local directory selected!");
}
// check if the local directory isn't used yet in another ownCloud sync
Folder::Map *map = _folderMap;
if( ! map ) return false;
if( isOk ) {
Folder::Map::const_iterator i = map->constBegin();
while( isOk && i != map->constEnd() ) {
Folder *f = static_cast<Folder*>(i.value());
QString folderDir = QDir( f->path() ).canonicalPath();
if( folderDir.isEmpty() )
{
isOk = true;
qDebug() << "Absolute path for folder: " << f->path() << " doesn't exist. Skipping.";
i++;
continue;
}
if( ! folderDir.endsWith(QLatin1Char('/')) ) folderDir.append(QLatin1Char('/'));
qDebug() << "Checking local path: " << folderDir << " <-> " << userInput;
if( QFileInfo( f->path() ) == userInput ) {
isOk = false;
warnString.append( tr("The local path %1 is already an upload folder.<br/>Please pick another one!")
.arg(QDir::toNativeSeparators(userInput)) );
}
if( isOk && folderDir.startsWith( userInput )) {
qDebug() << "A already configured folder is child of the current selected";
warnString.append( tr("An already configured folder is contained in the current entry."));
isOk = false;
}
if( isOk && userInput.startsWith( folderDir ) ) {
qDebug() << "An already configured folder is parent of the current selected";
warnString.append( tr("An already configured folder contains the currently entered directory."));
isOk = false;
}
i++;
}
}
// check if the alias is unique.
QString alias = _ui.aliasLineEdit->text();
if( alias.isEmpty() ) {
warnString.append( tr("The alias can not be empty. Please provide a descriptive alias word.") );
isOk = false;
}
Folder::Map::const_iterator i = map->constBegin();
bool goon = true;
while( goon && i != map->constEnd() ) {
Folder *f = static_cast<Folder*>(i.value());
qDebug() << "Checking local alias: " << f->alias();
if( f ) {
if( f->alias() == alias ) {
warnString.append( tr("<br/>The alias <i>%1</i> is already in use. Please pick another alias.").arg(alias) );
isOk = false;
goon = false;
}
}
i++;
}
if( isOk ) {
_ui.warnLabel->hide();
_ui.warnLabel->setText( QString::null );
} else {
_ui.warnLabel->show();
_ui.warnLabel->setText( warnString );
}
return isOk;
}