summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 29cce90..7abad69 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -93,87 +93,87 @@ ModulesInfo::~ModulesInfo()
93void ModulesInfo::updateData() 93void ModulesInfo::updateData()
94{ 94{
95 char modname[64]; 95 char modname[64];
96 char usage[200]; 96 char usage[200];
97 int modsize, usecount; 97 int modsize, usecount;
98 98
99 ModulesView->clear(); 99 ModulesView->clear();
100 100
101 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 101 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
102 102
103 if ( procfile ) 103 if ( procfile )
104 { 104 {
105 while ( true ) { 105 while ( true ) {
106 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 106 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
107 107
108 if ( success == EOF ) 108 if ( success == EOF )
109 break; 109 break;
110 110
111 QString qmodname = QString( modname ); 111 QString qmodname = QString( modname );
112 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 112 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
113 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 113 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
114 QString qusage = QString( usage ); 114 QString qusage = QString( usage );
115 115
116 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 116 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
117 } 117 }
118 118
119 fclose( procfile ); 119 fclose( procfile );
120 } 120 }
121} 121}
122 122
123void ModulesInfo::slotSendClicked() 123void ModulesInfo::slotSendClicked()
124{ 124{
125 if ( !ModulesView->currentItem() ) 125 if ( !ModulesView->currentItem() )
126 { 126 {
127 return; 127 return;
128 } 128 }
129 129
130 QString capstr = tr( "You really want to execute\n" ); 130 QString capstr = tr( "You really want to execute\n" );
131 capstr.append( CommandCB->currentText() ); 131 capstr.append( CommandCB->currentText() );
132 capstr.append( "\nfor this module?" ); 132 capstr.append( "\nfor this module?" );
133 133
134 QString modname = ModulesView->currentItem()->text( 0 ); 134 QString modname = ModulesView->currentItem()->text( 0 );
135 135
136 if ( QMessageBox::warning( this, modname, capstr, 136 if ( QMessageBox::warning( this, modname, capstr,
137 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 137 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
138 { 138 {
139 QString command = "/sbin/"; 139 QString command = "/sbin/";
140 command.append( CommandCB->currentText() ); 140 command.append( CommandCB->currentText() );
141 command.append( " " ); 141 command.append( " " );
142 command.append( modname ); 142 command.append( modname );
143 143
144 FILE* stream = popen( command, "r" ); 144 FILE* stream = popen( command, "r" );
145 if ( stream ) 145 if ( stream )
146 pclose( stream ); 146 pclose( stream );
147 } 147 }
148 148
149} 149}
150 150
151void ModulesInfo::viewModules( QListViewItem *modules ) 151void ModulesInfo::viewModules( QListViewItem *modules )
152{ 152{
153 QString modname = modules->text( 0 ); 153 QString modname = modules->text( 0 );
154 QString capstr = "Module: "; 154 QString capstr = "Module: ";
155 capstr.append( modname ); 155 capstr.append( modname );
156 ModulesDtl->setCaption( capstr ); 156 ModulesDtl->setCaption( capstr );
157 QString command = "/sbin/modinfo -nad "; 157 QString command = "/sbin/modinfo ";
158 command.append( modname ); 158 command.append( modname );
159 FILE* modinfo = popen( command, "r" ); 159 FILE* modinfo = popen( command, "r" );
160 160
161 if ( modinfo ) 161 if ( modinfo )
162 { 162 {
163 char line[200]; 163 char line[200];
164 ModulesDtl->detailView->setText( " Details:\n------------\n" ); 164 ModulesDtl->detailView->setText( " Details:\n------------\n" );
165 165
166 while( true ) 166 while( true )
167 { 167 {
168 int success = fscanf( modinfo, "%[^\n]\n", line ); 168 int success = fscanf( modinfo, "%[^\n]\n", line );
169 if ( success == EOF ) 169 if ( success == EOF )
170 break; 170 break;
171 ModulesDtl->detailView->append( line ); 171 ModulesDtl->detailView->append( line );
172 } 172 }
173 173
174 pclose( modinfo ); 174 pclose( modinfo );
175 } 175 }
176 176
177 ModulesDtl->showMaximized(); 177 ModulesDtl->showMaximized();
178} 178}
179 179