void MainWindow::setDocument( const QString &ipkFile ) { QString file = ipkFile; DocLnk lnk( ipkFile ); if ( lnk.isValid() ) file = lnk.file(); installLocalPackage( file ); }
/*! Returns the desktop file corresponding to this AppLnk. \sa file() exec() name() */ QString AppLnk::linkFile() const { if ( mLinkFile.isNull() ) { AppLnk* that = (AppLnk*)this; if ( type().contains('/') ) { StorageInfo storage; const FileSystem *fs = storage.fileSystemOf( that->mFile ); /* tmpfs + and ramfs are available too but not removable * either we fix storage or add this */ if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) { that->mLinkFile = fs->path(); } else that->mLinkFile = getenv( "HOME" ); that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); /* the desktop file exists make sure we don't point to the same file */ if ( QFile::exists(that->mLinkFile+".desktop") ) { AppLnk lnk( that->mLinkFile + ".desktop" ); /* the linked is different */ if(that->file() != lnk.file() ) { int n = 1; QString nn; while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) { n++; /* just to be sure */ AppLnk lnk(nn ); if (lnk.file() == that->file() ) break; } that->mLinkFile = nn; } } that->mLinkFile += ".desktop"; storeLink(); } return that->mLinkFile; } return mLinkFile; }
void PMainWindow::setDocument( const QString& showImg ) { QString file = showImg; DocLnk lnk(showImg); if (lnk.isValid() ) file = lnk.file(); slotDisplay( file ); #if 0 if (!m_polishDone) { QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); } #endif }
int main(){ scanf("%d%d",&N,&M); for(int i=1;i<=N;++i) lct[i]=new nd(i); for(int i=0,a,b;i<M;++i){ scanf("%s",S); if(S[0]=='c'){ scanf("%d",&a); cut(lct[a]); }else{ scanf("%d%d",&a,&b); if(S[1]=='c'){ printf("%d\n",lca(lct[a],lct[b])->val); }else{ lnk(lct[a],lct[b]); } } } }
bool KeyLauncher::onKeyPress(int keycode) { QString key; QStringList args; ConfigEx& cfg = ConfigEx::getInstance("keyhelper"); key = KeyNames::getName(keycode); if(key == QString::null) { return(false); } QString group = kind(); group[0] = group[0].upper(); /* read application launcher */ QString app = KHUtil::currentApp(); if(!app.isEmpty()) { cfg.setGroup(group + "_" + app); /* read config */ args = cfg.readListEntry(key, '\t'); } /* read default launcher */ if(args.isEmpty()) { cfg.setGroup(group); /* read config */ args = cfg.readListEntry(key, '\t'); } if(args.isEmpty()) { return(false); } /* launch application */ LnkWrapper lnk(args); if(lnk.isValid()) { //args.remove(args.begin()); lnk.instance().execute(); } return(true); }
void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { if (!item || ( button != Qt::LeftButton) ) return; OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); if (!sel->isLocked() ) { QStringList str = QStringList::split("->", sel->text(1) ); if (sel->isDir() ) { m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); emit selector()->dirSelected( m_currentDir ); reread( m_all ); } else { // file qWarning("slot Clicked"); selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } // not locked }
void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { if (!item) return; #if 0 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); if (!sel->isDir() ) { selector()->m_lneEdit->setText( sel->text(1) ); // if in fileselector mode we will emit selected if ( selector()->mode() == OFileSelector::FileSelector ) { qWarning("slot Current Changed"); QStringList str = QStringList::split("->", sel->text(1) ); QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } #endif }
void OFileSelector::slotFileBridge( const QString& str) { DocLnk lnk( str ); emit fileSelected( lnk ); }