Пример #1
0
GmailServiceRoot::GmailServiceRoot(GmailNetworkFactory* network, RootItem* parent) : ServiceRoot(parent),
  CacheForServiceRoot(), m_serviceMenu(QList<QAction*>()), m_network(network) {
  if (network == nullptr) {
    m_network = new GmailNetworkFactory(this);
  }
  else {
    m_network->setParent(this);
  }

  m_network->setService(this);
  setIcon(GmailEntryPoint().icon());

  recycleBin()->deleteLater();
  setRecycleBin(nullptr);
}
Пример #2
0
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
    if (!lpParam)
    {
        debug(D_ERROR, "Invalid parameters passed to ThreadPorc");
        return 1;
    }

    mount_params mp = *((mount_params*)lpParam);
    memset(lpParam, 0, sizeof(mount_params));
    pfs_params params = {0,};
    char auth[MAX_PATH]="";
    size_t cachesize;
    char* argv[2] = {(char *)"pfs", mountPoint};

    if (isFreeDevice(getMountLetter(mp.options)))
    {
        mountPoint[0] = getMountLetter(mp.options);
    }
    else
    {
        mountPoint[0] = getFirstFreeDevice();
    }

    memcpy(auth, mp.auth, sizeof(mp.auth));
    debug(D_NOTICE, "auth:%s", auth);

    cachesize = mp.cache;
    debug(D_NOTICE, "cache size:%u", cachesize);

    // Stored data is in MB - convert to bytes
    if (cachesize > 0 && cachesize < 3000)
    {
        cachesize *= 1024*1024;
    }

    params.use_ssl = (mp.options & OPT_MASK_OPTS) != 0;
    debug(D_NOTICE, "use SSL :%d", params.use_ssl);

    if (auth[0])
    {
        params.auth = auth;
        params.pass = NULL;
    }
    else
    {
        params.auth = NULL;
    }

    params.username = NULL;
    params.cache_size = cachesize?cachesize:512*1024*1024;

    setVolumeIcon(mountPoint[0], true);
    setRecycleBin(mountPoint[0], true);
    int res = pfs_main(2, argv, &params);
    setVolumeIcon(mountPoint[0], false);
    setRecycleBin(mountPoint[0], false);
    if (res == ENOTCONN)
    {
        debug(D_NOTICE, "Send NotConnected msg");
    }
    else if (res == EACCES)
    {
        debug(D_NOTICE, "Send Access denied msg");
    }
    return res;
}