void CController::setDisksChangedListener(CController::IDiskListObserver *listener) { assert_r(std::find(_disksChangedListeners.begin(), _disksChangedListeners.end(), listener) == _disksChangedListeners.end()); _disksChangedListeners.push_back(listener); // Force an update disksChanged(); }
// Sets the specified path, if possible. Otherwise reverts to the previously set path FileOperationResultCode CController::setPath(Panel p, const QString &path, FileListRefreshCause operation) { CPanel& targetPanel = panel(p); const QString prevPath = targetPanel.currentDirPathNative(); const FileOperationResultCode result = targetPanel.setPath(path, operation); saveDirectoryForCurrentDisk(p); disksChanged(); // To select a proper drive button return result; }
void StorageInfoView::init() { sinfo = QStorageMetaInfo::instance(); QLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 0 ); layout->setMargin( 0 ); area = new QScrollArea; layout->addWidget( area ); area->setFocusPolicy( Qt::TabFocus ); area->setFrameShape( QFrame::NoFrame ); updateMounts(); connect(sinfo, SIGNAL(disksChanged()), this, SLOT(updateMounts())); startTimer(60000); }
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) { setCaption( QObject::tr("Opie Eye" ) ); m_cfg = new Opie::Core::OConfig("opie-eye"); m_cfg->setGroup("main" ); readConfig(); m_setDocCalled = false; m_polishDone = false; m_SmallWindow = QApplication::desktop()->size().width()<330; m_storage = new StorageInfo(); connect(m_storage, SIGNAL(disksChanged() ), this, SLOT( dirChanged() ) ); m_stack = new Opie::Ui::OWidgetStack( this ); setCentralWidget( m_stack ); m_view = new PIconView( m_stack, m_cfg ); m_stack->addWidget( m_view, IconView ); m_stack->raiseWidget( IconView ); connect(m_view, SIGNAL(sig_display(const QString&)), this, SLOT(slotDisplay(const QString&))); connect(m_view, SIGNAL(sig_updateDisplay(const QString&)), this, SLOT(slotUpdateDisplay(const QString&))); connect(m_view, SIGNAL(sig_showInfo(const QString&)), this, SLOT(slotShowInfo(const QString&)) ); connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); listviewMenu = 0; /* setup menu and toolbar */ setupActions(); setupToolbar(); setupMenu(); m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); if (m_aForceSmall) { m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); } odebug << "mainwindow constructor done" << oendl; }
PackageModel::PackageModel( QObject* parent ) : QAbstractItemModel( parent ) , storage( 0 ) { networked = AbstractPackageController::factory( AbstractPackageController::network, this ); installed = AbstractPackageController::factory( AbstractPackageController::installed, this ); // can only have a max of 15 top level items rootItems << installed << networked; //this must stay in sync with installedIndex //and networkedIndex for ( int i = 0; i < rootItems.count(); i++ ) connect( rootItems[i], SIGNAL(updated()), this, SLOT(controllerUpdate()) ); connect( networked, SIGNAL(packageInstalled(InstallControl::PackageInfo)), installed, SLOT(addPackage(InstallControl::PackageInfo)) ); connect( networked, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); connect( networked, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(rowsRemoved(QModelIndex,int,int))); connect( networked, SIGNAL(packageInstalled(InstallControl::PackageInfo)), this, SLOT(packageInstalled(InstallControl::PackageInfo)) ); connect( networked, SIGNAL(serverStatus(QString)), this, SLOT(serverStatusUpdated(QString)) ); // can only have a max of 4 columns, if more are needed, change the // macros used for PackageModel::index(...) below // columnHeads << "Name" << "Size"; QStorageMetaInfo *s = QStorageMetaInfo::instance(); connect( s, SIGNAL(disksChanged()), this, SLOT(publishTargets()) ); connect( this, SIGNAL(targetsUpdated(QStringList)), installed, SLOT(reloadInstalledLocations(QStringList)) ); if ( !QDir( Qtopia::packagePath() ).exists() ) QDir::root().mkpath( Qtopia::packagePath() ); }
void MidpMountedRoots::update(bool notify) { DEBUG_PRINT("update"); #ifdef UNIX QValueList<QString> disks; QValueList<QString> paths; bool rebuild = false; int count = 0; // Read system mounts struct mntent *me; FILE *mntfp = setmntent("/etc/mtab", "r"); if (mntfp) { while ((me = getmntent( mntfp )) != 0) { QString disk = me->mnt_fsname; if (isValidDisk(disk)) { count++; disks.append(disk); QString path = QString(me->mnt_dir) + '/'; paths.append(path); if (!isCachedDisk(disk)) { rebuild = true; } } } endmntent(mntfp); } // Add special roots for PIM, FC and Private const pcsl_string* storage = storage_get_root(INTERNAL_STORAGE_ID); if (pcsl_string_length(storage) >= 0) { const char* cstorage = (const char*)pcsl_string_get_utf8_data(storage); QString qstorage = cstorage; pcsl_string_release_utf8_data((const jbyte*)cstorage, storage); QString fc = qstorage + "storage/"; QFile ffc(fc); // determine whether the path exists // Note: the path is created by the build system. if (ffc.exists()) { count++; const QString name = "storage"; disks.append(name); paths.append(fc); if (!isCachedDisk(name)) { rebuild = true; } } QString pim = qstorage + "pimdb/"; QFile fpim(pim); // determine whether the path exists // Note: the path is created by the build system. if (fpim.exists()) { count++; const QString name = "pimdb"; disks.append(name); paths.append(pim); if (!isCachedDisk(name)) { rebuild = true; } } QString prv = qstorage + "private/"; QFile fprv(prv); // determine whether the path exists // Note: the path is created by the build system. if (fprv.exists()) { count++; const QString name = "private"; disks.append(name); paths.append(prv); if (!isCachedDisk(name)) { rebuild = true; } } } if (rebuild || count != (int)mRoots.count()) { mRoots.clear(); QStringList::ConstIterator it = disks.begin(); QStringList::ConstIterator pit = paths.begin(); for (; it != disks.end(); ++it, ++pit) { QString disk = *it; QString path = *pit; QString root, local; if (getDiskInfo(disk, root, local)) { MidpFileRoot* fs = new MidpFileRoot(disk, path, root, local); mRoots.append(fs); } } // Call the handler if required if (notify) { disksChanged(); } } #endif }
// Go to the next location from history, if any void CController::navigateForward(Panel p) { panel(p).navigateForward(); saveDirectoryForCurrentDisk(p); disksChanged(); // To select a proper drive button }
if (exportable.isEmpty()) { qLog(USB) << "No exportable storage locations"; return; } foreach (QFileSystem *fileSystem, exportable) { storageGadget->addBackingStore(fileSystem->disk()); } QCoreApplication::processEvents(); } // disconnect all backing stores BackingStoreFileSystemFilter filter(storageGadget->backingStore()); m_fileSystems = QStorageMetaInfo::instance()->fileSystems(&filter, false); connect(QStorageMetaInfo::instance(), SIGNAL(disksChanged()), this, SLOT(activateStorageGadget())); bool disconnected = false; foreach (QFileSystem *fileSystem, m_fileSystems) { if (fileSystem->isConnected()) { qLog(USB) << "disconnecting" << fileSystem->disk() << fileSystem->path(); fileSystem->disconnect(); disconnected = true; } } if (!disconnected) QTimer::singleShot(0, this, SLOT(activateStorageGadget())); connect(storageGadget, SIGNAL(deactivated()),